Hello! I've tried to play around with compiling a static lib w/ gcc, and using it in blitzmax. It seems I am failing :P Hopefully some kind soul out there in blitzland will be able to help me out :D (Drago..? anyone..? ..bueller?)
Anyways this is what I've done. I have the following extremely simple source file to work with in c:
First, I went and compiled the .c file into a .o object file using gcc. Afterwards I used the ar program to throw the object file into a .a file, which is in my understanding an archive of object files. (Or basically a static library)
Then I went and created the following path in my blitzmax folder.. \mods\surreal.mod\test.mod , and placed the static lib file (statictest.a) within it. Along with this I've gone and created test.bmx, and placed the following code inside:
Anyways on to test it. I create a new .bmx file which looks like this:
Compile Error:Can't find interface for module 'surreal.test'
I've triple checked the path involved (bmaxroot\mod\surreal.mod\test.mod), and it contains the following files:
libstatictest.a
test.a
test.bmx
test.i
and within surreal.mod\test.mod\.bmx:
test.bmx.i
test.bmx.o
test.bmx.s
I have only tried compiling in release mode, as I realize there is no debug mode version of the lib to compile with. (I've noticed how there are two versions of each module, obviously the '.d.' in the filename denotes debug versions in other mods)
Other things I've tried, with no effect:
-Copying libstatictest.a into .bmx dir. (Didn't think this would work since I've never seen a .a file in a .bmx folder.. but hey)
-Using Extern "Win32" instead of just Extern
-Renaming everything since originally I named the function, module, and library "test"
-Banging my head against the wall.
Sadly, I'm running out of ideas.. so if anyone could help me out, I'd be very greatful.
Thanks in advance :)
Anyways this is what I've done. I have the following extremely simple source file to work with in c:
//testsource.c int testfunc(int a,int b) { return a + b; }I pieced together the following steps from several tutorials on compiling/linking static libs.. so bare with me.
First, I went and compiled the .c file into a .o object file using gcc. Afterwards I used the ar program to throw the object file into a .a file, which is in my understanding an archive of object files. (Or basically a static library)
Then I went and created the following path in my blitzmax folder.. \mods\surreal.mod\test.mod , and placed the static lib file (statictest.a) within it. Along with this I've gone and created test.bmx, and placed the following code inside:
Strict Module surreal.test Import "-lstatictest" Extern Function testfunc:int (a, b) End ExternAfter saving this module, I've been able to successfully compile it using "bmk makemods -r surreal.test", with no errors. So far so good.. (Or so I'd like to believe)
Anyways on to test it. I create a new .bmx file which looks like this:
Import surreal.test Print testfunc (1,2)As you can see I'm striving for the simplest code here, just trying to get the pipeline down.. and this is where I run into problems. Upon trying to compile this example, I get the following compile error:
Compile Error:Can't find interface for module 'surreal.test'
I've triple checked the path involved (bmaxroot\mod\surreal.mod\test.mod), and it contains the following files:
libstatictest.a
test.a
test.bmx
test.i
and within surreal.mod\test.mod\.bmx:
test.bmx.i
test.bmx.o
test.bmx.s
I have only tried compiling in release mode, as I realize there is no debug mode version of the lib to compile with. (I've noticed how there are two versions of each module, obviously the '.d.' in the filename denotes debug versions in other mods)
Other things I've tried, with no effect:
-Copying libstatictest.a into .bmx dir. (Didn't think this would work since I've never seen a .a file in a .bmx folder.. but hey)
-Using Extern "Win32" instead of just Extern
-Renaming everything since originally I named the function, module, and library "test"
-Banging my head against the wall.
Sadly, I'm running out of ideas.. so if anyone could help me out, I'd be very greatful.
Thanks in advance :)