[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
linking
From: |
John W. Eaton |
Subject: |
linking |
Date: |
Wed, 7 Apr 2010 17:03:04 -0400 |
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
- linking, Andy Buckle, 2010/04/07
- linking,
John W. Eaton <=