[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: linking
From: |
Andy Buckle |
Subject: |
Re: linking |
Date: |
Wed, 7 Apr 2010 22:13:22 +0100 |
No, I had not tried that.
That works elegantly. Many thanks
On Wed, Apr 7, 2010 at 10:03 PM, John W. Eaton <address@hidden> wrote:
> On 7-Apr-2010, Andy Buckle wrote:
>
> | I have had trouble trying to link. I have made a simple example that
> | illustrates the problem, and my ugly solution. Is is possible to avoid
> | the system call to ar? (All files in the same directory).
> |
> | file: b.h
> | double b_fn(double in);
> |
> | file: b.cpp
> | #include "b.h"
> | double b_fn(double in) {
> | return in*in;
> | }
> |
> | file: a.cpp
> | #include <octave/oct.h>
> | #include "b.h"
> |
> | DEFUN_DLD (a, args, nargout,
> | "no help available for this test fn") {
> | if (args.length() != 1) {
> | error("a: there must be 1 arg");
> | return octave_value_list();
> | }
> | double in=args(0).double_value();
> | double out=b_fn(in);
> | return octave_value(out);
> | }
> |
> | file: compile.m
> | clear a b
> | delete *.o
> | delete *.oct
> | delete *.a
> | mkoctfile -c a.cpp
> | mkoctfile -c b.cpp
> | system('ar cr libb.a b.o')
> | mkoctfile -L. -lb a.o
>
> Did you try
>
> mkoctfile a.cpp b.cpp
>
> ?
>
> jwe
>
--
/* andy buckle */
- linking, Andy Buckle, 2010/04/07
- linking, John W. Eaton, 2010/04/07
- Re: linking,
Andy Buckle <=