Create external library for use in C++?

BlitzMax Forums/BlitzMax Programming/Create external library for use in C++?

Tibit(Posted 2005) [#1]
(see topic ) Can I do this with BlitzMax? Is it possible to use a blitzmax library in a C++ project or would I have to rewrite all code?

Perhaps it is a stupid question but I know "nothing" about DLL's and C++ ;)
So if you know how this would work please explain.


Steve Elliott(Posted 2005) [#2]
Take a look at this: www.blitzwiki.org/index.php/C_CallBacks


TartanTangerine (was Indiepath)(Posted 2005) [#3]
Ohh thats nice.


Tibit(Posted 2005) [#4]
I don't get it. How does that example run from c++ and call a Bmax function?

Isn't it a BMax program that calls a C function which in-return calls a BMax function? Or is it the same thing?

I mean can a C program call a blitzmax function only if it's code is imported and run from a bmax program?

"Calling Max functions from C is a little complicated by the fact that you have to "tell" C where the Max function is. If you've found out how to get round this, please do tell! "
Is this solved?


verfum(Posted 2007) [#5]
"Calling Max functions from C is a little complicated by the fact that you have to "tell" C where the Max function is. If you've found out how to get round this, please do tell! "

Is this solved?


I've managed it - by getting Max to tell the C++ app what its function pointers are - then Max calls a pre-defined "entry point" in the C++ app (DLL) - you are then free to call Blitz functions directly from C++.
You can even use, say, the MS Visual Studio debugger too! If anyone's interested I'll dig out my code.