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 / Need Help Writting DBP DLL With Dev C++ v5 beta

Author
Message
GatorHex
19
Years of Service
User Offline
Joined: 5th Apr 2005
Location: Gunchester, UK
Posted: 22nd Jun 2007 01:30 Edited at: 22nd Jun 2007 01:43
Ok I've had a go with the free Dev C++ but I'm getting an error message after compiling the DBP program that my new functions don't exist



the compiled dll has been copied to dbp/compiler/plugins-user folder

DBP


main.cpp


commands.rc


what have I missed?

I got a feeling the DBP exmple has errors in the commands.rc with getInterger / GetValue but why doesn't PrintText work?

Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 22nd Jun 2007 02:29 Edited at: 22nd Jun 2007 02:47
It's because of the way that the garbled function names are exported with the mingw compiler. With an msvc compiler, your exported function name would look something like what you have ( ?PrintText@@YAXPAD@Z ), but with mingw the exported function would look like this: _Z9PrintTextPc

You can find out the exported function name by simply examining the dll in notepad once compiled. So basically you code your function, compile the dll, open it in notepad, change the function name in the string table to the exported garbled one, then recompile to include the correctly modified string table in the dll.

Attatched is a very simple devcpp (v4.9.9.2) project that has your PrintText function working. The only code needed is below.

Main source:


String table resource file:


Just copy the dll included in the archive into your 'plugins-user' folder and compile 'print text "hello" : wait key' in dbp to see it in action.

EDIT:
Not sure if the project will work with the v5 beta of devcpp, but give it a try anyway.

EDIT2:
Also see this thread for a very easy step-bystep way to create a simple dll in devcpp: http://forum.thegamecreators.com/?m=forum_view&t=105976&b=18

Hope this helped.

Who needs a signature?

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-22 21:39:06
Your offset time is: 2024-11-22 21:39:06