Hi,
Could someone tell me what might be going wrong with this procedure. I am creating a dylib on Leopard 10.5.2 with the following function:
testdll.cpp:
extern "C" {
int testcall(int x)
{
return x;
}
}and compiling with the following line
g++ testdll.cpp -dynamiclib -o libtestdll.dylib
using nm on the resulting dylib produces the following entry
00000ff2 T _testcall
So I copy the dylib to both /usr/lib and /sw/lib and insert the following var line into my project:
function testcall(a : integer) : integer; cdecl; external 'testdll';and inside a button click invoke it with
b := testcall(5);and the project invariably fails linking with the following:
Undefined symbols:
"_testcall", referenced from:
UNIT1_TFORM1_$__BUTTON1CLICK$TOBJECT in Unit1.o
ld: symbol(s) not found
This same procedure works fine in the same project utilizing the likes of strlen from one of the standard libs. I've also tried utilizing __attribute__((visibility("default"))) before the call in the library.
Anyone have any suggestions as to why this is failing or provide a set of instructions on producing a minimally funcation dylib that works with Lazarus on the Mac?
Thanks