writing C++ dll for blitz
BlitzPlus Forums/BlitzPlus Beginners Area/writing C++ dll for blitz
| ||
Hello- I Crated a new C++ project in Eclipse, set it for shared library, wrote a simple function, built the dll and copied it to the userlib folder. I created a decls file but I keep getting an "illegal type conversion" not sure what the problem is. Would somebody be kind enough to demonstrate a simple function that add 2 integers and returns the result with a c++ dll? Thanks! |
| ||
lets say I have a function called "join" that joins 2 strings: .lib "mydll3.dll" join(a$,b$) gets me illegal type conversion join$(a$,b$) gets me user lib not found ? |
| ||
here's the cpp source: #include <math.h> #include <stdlib.h> // #define BBDECL extern "C" __declspec (dllexport) #ifdef __cplusplus #define BBDECL extern "C" __declspec (dllexport) #else #define BBDECL __declspec (dllexport) #endif #define BBCALL _stdcall BBDECL int BBCALL myfunc( int a, int b ){ int c = a+b; return c; } here's the decls: .lib "mydll4.dll" myfunc%( a%, b% ):"_myfunc@8" Compiled both 32 and 64 bit both give the error "user lib function not found". |
| ||
Have you tried placing that DLL in the same folder as the blitz source code or compiled executable, or at least in your System32 folder? |
| ||
I put the dll and the decls in the userlibs folder in blitzplus |
| ||
if I put it in the same folder as teh test.bb program that I call it from c=myfunc(1,5) i get an "illegal type conversion" error |
| ||
maybe eclipse is mangling it somehow? maybe i should use vc++? has anybody had any luck with either of these? |
| ||
Try the example from the Specifications. Does that work? |
| ||
nope - wont compile the sample wont compile in either eclipse or vc++ |
| ||
got it working with dev-c++ |