🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #15644

Re: Dynamic DLL..Help!

#15644
From: Loz
Date: Thu, 19 Jun 2003 15:40
39 lines
2617 bytes
I seem to be talking to myself a lot at the moment!

My current findings are thus...

I don't think there ever was an issue with __cdecl or __stdcall, I think 
it was more an issue of additional threads calling the DllEntryPoint 
multiple times which was confusing me.

I've encapsulated my initialisation code within the DllEntryPoint by 
checking for DLL_PROCESS_ATTACH and then my uninitialising / destructor 
code within the entry point by checking for DLL_PROCESS_DETACH when it's 
finally unloaded.  This works fine.

My issue regarding multiple instances of the DLL - I've since discovered 
that I can only load one instance of a DLL per 'process'.  Every time I 
load the dll using LoadLibrary, it simply increments a count within the 
dll .  I think this means that any globals within the DLL are shared 
within the calling process so I don't actually have a separate instance.  
To create, manage and use multiple instances of classes within the DLL, 
I need to create my own management code.  Is this correct?

For example, within my dll I have classes that declare TCP and UDP 
Client and Server engines.  Access to these components is through a 
defined interface.  If I want to create both a TCP and UDP Server, I 
would have to create two pointers internal to the DLL, one for managing 
the TCP object, and one for the UDP object.  

What I was trying to do before was declare one pointer per 'dll 
instance' that would access the 'instance object type' but because I 
can't create 'separate DLL instances', the pointer was being use to 
create one object, and then being used again to create the next object.  
Hence this didn't work!  

I think I've got it right?  Can anyone confirm this for me please?  
Remy?

Thanks,

Loz
Technical Details
Message-ID: <Xns939FA9809D1BCLoz@207.105.83.65>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <Xns939EA95FE5225Loz@207.105.83.65> <Xns939F5F8BEC2F4Loz@207.105.83.65> <Xns939F8DB60F221Loz@207.105.83.65>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,96f04d20cd206c09
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-06-19 08:41:20 PST
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Dynamic DLL..Help!
From: Loz <noemail@nowhere.com>
References: <Xns939EA95FE5225Loz@207.105.83.65> <Xns939F5F8BEC2F4Loz@207.105.83.65> <Xns939F8DB60F221Loz@207.105.83.65>
Message-ID: <Xns939FA9809D1BCLoz@207.105.83.65>
User-Agent: Xnews/5.04.25
NNTP-Posting-Host: 217.37.62.138
Date: 19 Jun 2003 08:40:01 -0700
X-Trace: newsgroups.borland.com 1056037201 217.37.62.138 (19 Jun 2003 08:40:01 -0700)
Lines: 39
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail