Importing/Using external c++ source

BlitzMax Forums/BlitzMax Beginners Area/Importing/Using external c++ source

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

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.