Importing/Using external c++ source
BlitzMax Forums/BlitzMax Beginners Area/Importing/Using external c++ source
| ||
Hi, Wondering how difficult it is to use c++ with BlitzMax.I have an application which is written in c++ and once compiled uses a flag to get it's input.The source uses #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <ctype.h> #include <unistd.h> #include <sys/time.h> Any suggestions on how to integrate this apps functionality into my BlitzMax app ? Thanks in advance. |
| ||
Check the manual under the Advance Topics section. There you can find some sample code showing how to use c++ code with Bmax. |
| ||
Well there's no way to directly call any c++ code from max. Anything you want max to interact with has to be wrapped in an a C function. [code] class CStuff public: CStuff(){ ... } . . . int DoThing(...){} private: DataType* someData; }; extern "C"{ void* NewCStuff(){ CStuff* temp = new CStuff return (void*)(temp) } int DoThingCStuff(void* myStuff, ...){ return (CStuff*)(myStuff)->DoThing(...) } } I haven't used any C with max so I'm not 100% sure that's all correct, but it's a general idea at least. |