Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / How Does DarkBasic Pro Close

Author
Message
N3wton
14
Years of Service
User Offline
Joined: 3rd Jun 2009
Location: Leeds, UK
Posted: 6th Jan 2010 03:48
I'm currently wrapping the USkin.dll for darkbasic as just calling the commands from the dll leads to a crash on exit. This has something to do with memory not being released from somewhere or something

So using the USkin.dll and USkin.lib I have made a plugin which (Currently) consists of two commands

Skin_Start and Skin_End

Skin_Start skins the application with the selected .msstyles file and works perfectly.

Skin_End calls only one command from the .lib/.dll but it still makes the darkbasic application crash on close.

I have compiled the examples that come with uskin for c++ and they run fine and dont crashon exit. so i'm trying to work out why it does with darkbasic. thus my question....

How does DarkBasic Close does it just use the ExitProcess command or pass the windowclose thing to the stack or what?

Yours
N3wton

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Jan 2010 22:48
I don't understand how knowing that will help you solve your problem, however ...

If an error occurs in a command, it sets an error status before returning to user code. The user code checks the error status (as it does after every command), and if it contains a non-zero value, jumps to a cleanup section in the user code.

If the user code instead includes an END statement, that END statement unconditionally jumps to the cleanup section.

The cleanup section calls the Quit routine in the core DLL (which handles the message box display of the EXIT PROMPT command. It then returns to the cleanup section, which resets the stack pointer to a known point and then returns (presumably to the .EXE code where further cleanup takes place and all DLL's and DirectX resources are torn down).

You can pretty much get most of that from the .dbm file that's produced during compilation.

Now to your problem ... I suspect that somewhere along the line you are corrupting memory, possibly by double-freeing it, or by using it sometime after freeing it.

Login to post a reply

Server time is: 2024-03-28 19:17:09
Your offset time is: 2024-03-28 19:17:09