K
Karel Van Laer
Hi everyone,
I need to be able to mix C and C++.
The main program is written in C and needs to access C++ code.
To be more specific it's a user defined function in fluent, but this
should not be relevant.
I've allready read that i need to use the extern "C" construction but i
don't seem to be doing it right.
So far i've got this compiled:
<file: cpplib.cpp>
extern "C" int function(); //declaration
int function(){...} //definition
</file: cpplib.cpp>
<file: cpplib.h>
int function(){}
</file: cpplib.h>
<file: cprogram>
#include "cpplib.h"
...//call "function()" somewhere
</file: cprogram>
When i try to run it this generates the following error:
/opt/Fluent.Inc/fluent6.3.26/lnx86/2d/fluent.6.3.26: symbol lookup
error: libudf/lnx86/2d/libudf.so: undefined symbol: init
"init" is the function i'm trying to call here.
I'm hoping somebody here can give me an idea of what i'm doing wrong here.
Karel
I need to be able to mix C and C++.
The main program is written in C and needs to access C++ code.
To be more specific it's a user defined function in fluent, but this
should not be relevant.
I've allready read that i need to use the extern "C" construction but i
don't seem to be doing it right.
So far i've got this compiled:
<file: cpplib.cpp>
extern "C" int function(); //declaration
int function(){...} //definition
</file: cpplib.cpp>
<file: cpplib.h>
int function(){}
</file: cpplib.h>
<file: cprogram>
#include "cpplib.h"
...//call "function()" somewhere
</file: cprogram>
When i try to run it this generates the following error:
/opt/Fluent.Inc/fluent6.3.26/lnx86/2d/fluent.6.3.26: symbol lookup
error: libudf/lnx86/2d/libudf.so: undefined symbol: init
"init" is the function i'm trying to call here.
I'm hoping somebody here can give me an idea of what i'm doing wrong here.
Karel