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 / DGSDK, the DLLMain confliction problem

Author
Message
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 23rd Jan 2006 13:14 Edited at: 23rd Jan 2006 15:12
Hi all. Been a while since I've posted on here, but I've got a question regarding the DGSDK. Basically, I've converted all my XScape source over to use the DGSDK instead of what used to be the interface library based on the DBP core DLLs. All well and good, and so far, the conversion worked without a hitch.... until it came to XScape's plugins.

I won't bore you with the mundane details for plugin architecture except that they are DLLs. The problem is that linking EXE projects with the DGSDK static libaries is great, but I can't do the same for my DLL projects because it appears that 'Core.lib' already contains a DLLMain entry point. Now I can appreciate that the static libs were basically modified versions of the existing DBP core libraries, but can the redundent DLLMain entry be hash defined out of the compile process if they are being generated as static libs for the DGSDK.

Also, can someone provide me a solution that will allow me to compile my normal XScape plugin DLLs which reference the static libraries without having linker conflicts with DLLMain.

Cheers guys.

Paul.

[EDIT] It occurred to me that even though linking to static libraries in a DLL is possible, there should be an additional function available in the libraries that allows for a GlobalStruct *g_pGlob value to be set via the DLL. The application that invoked the DLL, i.e. my XScape plugin would then be responsible for setting this *g_pGlob pointer to the same one that was issued to the original EXE. Hence all DLLs would still use the same Global structure and function pointers etc. Surely this is possible? Mike, Lee, anyone.


Home of the Cartography Shop - DarkBASIC Professional map importer
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 23rd Jan 2006 16:01 Edited at: 23rd Jan 2006 16:04
As you've discovered DarkSDK cant be used in DLL's - due to DLLMain...

I'm not sure of an easy way around it - the usual thing to do is to /ignore libraries or modify the order the modules are compiled it - however I dont think that works in this case. LIBC especially cant be ignored...

Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Smoke me a computer chip, I'll be baking breakfast.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 23rd Jan 2006 17:20
Yeah I agree, I'm just confused as to why there would be a DLLMain entry point in static libraries. Surely this would only apply to DLL compiled files for the DBP system. In this case, it only needs to be #define'd out of the build. The core libraries must have a WinMain entry point since void DarkSDK( void ) is the entry point for our EXEs. If we are to use DLLs, it's only important that the EXE that instantiated the DLL, passes the pGlob structure from the main EXE, to the DLL, e.g. via a required default exported function from the DLL called

void SetGlobPtr( GlobStruct *pGlob );

I did try to ignore the core.lib file as part of the DLL build but this IMO isn't a good idea anyway, since there are other global dependencies that the other static libraries depend on.

If Mike could make a minor modification that applies to the above hypothesis, this would solve the problem. Release 1.1.2 or something.

Paul.


Home of the Cartography Shop - DarkBASIC Professional map importer
Mike Johnson
TGC Developer
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 23rd Jan 2006 19:24
I will add defines to ensure anything related to DLLs aren't included in the source.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 23rd Jan 2006 20:01
Fantastic Mike, many thanks. I look forward to the update

Paul.


Home of the Cartography Shop - DarkBASIC Professional map importer

Login to post a reply

Server time is: 2024-05-17 12:16:07
Your offset time is: 2024-05-17 12:16:07