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.

Dark GDK / Possible to export GDK functions to a DLL?

Author
Message
gameboy
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location:
Posted: 20th Apr 2007 21:59 Edited at: 21st Apr 2007 16:17
I'm trying to program DarkGDK using BlitzMax (I like its simplicity, object-orientedness, and fast compiling).

I've been trying to create a DLL to export the functions in the various DarkSDK header files (I'm using Visual Studio 2005).

Prefixing the function names with __declspec(dllexport) doesn't seem to work. The function names are not being exported [for some] reason. Are all those #pragma comment ( lib...) statements in DarkSDK.h somehow preventing the functions from being exported in the DLL?

Is it even possible to export the GDK functions to a DLL?

[EDIT] inserted missing text
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 21st Apr 2007 00:47
The problem is that the header files are used to resolve the bindings you call within your code itself, to the libraries. If you want to export the functions, you need to create 'Thunk' functions. I.e. Functions you declare using the __declspec( dllexport ) specification, which themselves call into the library functions. The irony is, this is basically how I created the DGDK.NET version of the toolkit... with added code to deal with authenticity of a COM component.

Paul.


Abundance = Choice = Freedom - Scarcity = Dependancy = Control, Truth!
gameboy
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location:
Posted: 21st Apr 2007 04:36
Thanks Paul. So it seems there is no advantage in trying to use something like BlitzMax over just using DarkGDK.NET - both have to use another layer of function calls to get to the actual functions.

*sigh*. I guess I should've just bought DarkGDK.NET to start with (or else just code in C++).
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 21st Apr 2007 04:54 Edited at: 21st Apr 2007 05:12
Well, it's difficult to asses how BlitzMax interacts with third party components since I've not used it. But if my understanding of most modern day development tools go, I can only assume that BlitzMax binds to DLL functions at runtime based on programmatic function specifications defined in your code. I.e. Visual Basic (v6) used the module 'Declare Sub/Function' syntax to create runtime bindings to standard DLL exports such as Win32 calls into the Window Kernel to perform standard system calls.

The only major problem is that, even if you defined thunk functions to expose methods from the C++ library, you'd still need to know what initial functions to call into the libraries in order to fire up the DGDK engine to begin with. I had to speak with Mike over this matter when it came to the DGDK.NET toolkit design.

My point is this, you CAN create methods that are exported from a DLL which wraps the C++ libraries, but you need to seriously consider the consequences of distributing a DLL that essentially wraps the DGDK C++ libraries, where by you're providing functions to use the library. You can't just wrap the libraries and distribute the DLL as part of your application, because you're violating the license of the toolkit. By wrapping the C++ libraries into a DLL and exporting such functions is basically illegal because you're providing a way for anybody to link to your Application's DLL to use the toolkit. Hence my authentication code.

Paul.

[EDIT] Typo corrections


Abundance = Choice = Freedom - Scarcity = Dependancy = Control, Truth!
gameboy
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location:
Posted: 21st Apr 2007 16:27 Edited at: 21st Apr 2007 16:27
Well, since it is not allowed to create DLLs with DarkGDK, that settles the matter once and for all. (*Project scrapped*)

Login to post a reply

Server time is: 2024-11-19 13:18:49
Your offset time is: 2024-11-19 13:18:49