Help with TailBite: Memory error when using my library
Posted: Wed Jan 05, 2005 6:02 pm
I have a C/C++ DLL with some exposed functions which I wish to wrap into a UserLibrary. I have many functions similar to this:
When I use these functions from an EXE they all work perfectly fine, but when I use TailBite to make a UserLibrary, the function calls make the program crash with a memory read error at address 0x000000ff.
Here's some example of the C code:
Code: Select all
ProcedureDLL.l i3D_Initialize3D(width.l,height.l,bits.l,isFullscreen.l,isResizable.l,*CallBackProcedure) ; Starts the 3d engine. CallBackProcedure(id.l). YOU MUST CALL THIS BEFORE OTHER i3D FUNCTIONS
i3D_Library=OpenLibrary(#PB_Any,"./PB_Irrlicht.dll")
If IsLibrary(i3D_Library)
ProcedureReturn CallCFunction(i3D_Library,"pb_Initialize3D",width,height,bits,isFullscreen,isResizable,*CallBackProcedure)
Else
ProcedureReturn 0
EndIf
EndProcedure
ProcedureDLL.l i3D_IsRunning() ; See if the 3d engine is running or crashed/stopped
ProcedureReturn CallCFunction(i3D_Library,"pb_Running")
EndProcedure
Here's some example of the C code:
Code: Select all
//Create the devices for the PB engine - MUST BE CALLED BEFORE ANYTHING ELSE
API int CALLCONV pb_Initialize3D(int width,int height,int bits,int isFullscreen,int isResizable,void (*EventCallBack)(int))
{
pb_device = createDevice(OPENGL,dimension2d<s32>(width,height),bits,pb_intToBool(isFullscreen),true,false);
if (pb_device==0)
return 0;
EventCallBackPtr = EventCallBack;
pb_device->setEventReceiver(&pb_receiver);
pb_device->setResizeAble(pb_intToBool(isResizable));
//get video driver and scene manager and gui
pb_driver = pb_device->getVideoDriver();
pb_scene = pb_device->getSceneManager();
pb_gui = pb_device->getGUIEnvironment();
pb_camera = pb_scene->addCameraSceneNode(0,vector3df(0,0,0),vector3df(0,0,0),0);
return 1;
}
//Set the window caption
API void CALLCONV pb_SetWindowCaption(char * text)
{
stringw k=L"";
k += text;
pb_device->setWindowCaption(k.c_str());
}