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 / DarkGDK and loading DLLs

Author
Message
RichBurb
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: The Dark Side of the Moon
Posted: 22nd Apr 2011 20:15
I am trying to use the following:

dbDLLLoad("Buzzer.dll",1);

But the result is:
1>Main.obj : error LNK2019: unresolved external symbol "void __cdecl dbDLLLoad(char *,int)" (?dbDLLLoad@@YAXPADH@Z) referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)

1>Debug\Dark GDK - 2D Game3.exe : fatal error LNK1120: 1 unresolved externals


The DarkGDK documentation states that the command should be:
void dbLoadDLL ( char* Dllname, int DllNumber )
but any attempt to use dbLoadDLL("Buzzer.dll",1) results in an unknown identifier error for dbLoadDLL.

Has the ability to load and used DLLs been left out of DarkGDK?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Apr 2011 00:27
It definitely used to be there.

TBH though, you really shouldn't use the DLL commands, for the same reason that you shouldn't use the File commands - there are better ways to do the same job using standard windows functions.

Follow this link for an example: http://msdn.microsoft.com/en-us/library/ms686944(VS.85).aspx

RichBurb
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: The Dark Side of the Moon
Posted: 23rd Apr 2011 19:43 Edited at: 23rd Apr 2011 22:31
Thanks! That is a MUCH cleaner and easier way to accomplish what I needed.
Now if only I could get that example to work with a DarkGDK project. I can open a new console project and it works fine, but with a DarkGDK project (started with the wizard) it does not work.

Compiling the same code after beginning with the DarkGDK wizard results in the following error:

1>darksdk.lib(DarkSDK.obj) : error LNK2019: unresolved external symbol "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ) referenced in function _WinMain@16
1>Debug\Dark GDK - 2D Game3.exe : fatal error LNK1120: 1 unresolved externals

Any ideas? My guess is it is related to some mysterious linker setting that gets changed when the GDK wizard runs, but as an inexperienced C++ programmer I'm not even certain that guess is right.
RichBurb
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: The Dark Side of the Moon
Posted: 23rd Apr 2011 22:30
Since I have been unable to compile the example provided by IanM when using DarkGDK, I've taken a shot at using the dbLoadDLL() again. I managed to get that command and dbCallDLL() to compile.

I need to find a way to pass text to the DLL (which the description of dbCallDLL() seems to indicate is possible. However, it appears that this command and it's sibling dbCallDLLX only take DWORDs.

dbCallDLLX() looks like it should be able to take a DWORD pointer for the 3rd param, but the compiler insists it can only take DWORD.

Is there a way to pass a string?

Commands for communicating with HIDs would be a nice addition to DarkGDK.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Apr 2011 23:12
Quote: "Now if only I could get that example to work with a DarkGDK project"

The linker error is indicating that you haven't defined a DarkGDK function in your code - that's what 'unresolved external symbol' means. Did you simply copy/paste the example?

You need to change the code appropriately for GDK - replace the printf's with print's, replace the dll name with your dll name, replace the typedef with one appropriate to the function you want to call, and change the exported function name is GetProcAddress to the function you want to call. Add the standard LoopGDK loop and you're good to go.

RichBurb
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: The Dark Side of the Moon
Posted: 25th Apr 2011 04:00
No, I made all the changes required and the program ran great with the DLL I wanted to use as long as I didn't try to put the code into a DarkGDK project. When I put it into a DarkGDK project, it compiles fine, but the DLL calls do not work.

I'll give it another go with great attention to details, but I think the DLL might not work because the DarkGDK may be monoplizing the "joypad" input device and won't let my DLL take a turn sending a message to the HID.

Login to post a reply

Server time is: 2024-11-23 10:22:24
Your offset time is: 2024-11-23 10:22:24