Creating Extension Libraries

Previous  Next

 

A MyBASIC2 Extension Library is a DLL with 2 exported functions;

 

int mb_ext_load( mb_interpreter_t* s )

int mb_ext_unload( mb_interpreter_t* s )

 

Using MS Visual++ you can declare them as

 

extern "C" __declspec(dllexport) int  mb_ext_load( mb_interpreter_t* s )

extern "C" __declspec(dllexport) int  mb_ext_unload( mb_interpreter_t* s )

 

The mb_interpreter_t structure is defined in MyBASIC2.h so you will need to include this

 

To use the extension library in your MyBASIC2 code use:

 

$LIBRARY "MyExtensionLibrary"

 

The extension .DLL is added if not supplied