🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Callback, Dll, Thread and synchronization HELP!

#2507
From: Stefano Bonifazi
Date: Fri, 09 Feb 2007 08:13
33 lines
2827 bytes
Hi mr. Lebeau! Thank U!

>> The Critical Section is initializated in the Initialize function of
> my
>> DLL, and deleted in its Close function (the first and last the user
> must
>> call!)
> 
> You are going about this all wrong.  You are not responsible for
> providing thread-safety functions for the application to use.
> Especially if you are going to compile your DLL for other platforms,
> so you can't use platform-specific objects anyway.  The application
> has to manage its own thread safety on its own outside of your DLL.

Well I expressed myself badly :( ... On the console application I wrote 
a C++ unit (no BCB!) responsible of loading dynamically my DLL and that 
actually furnishes the interface for working with the DLL. So for 
example the initialize function on that unit calls the Initialize 
function on the DLL in Win32 way (LoadLibrary, GetProcAddress...) So in 
that function that is in the console application I can create the 
Critical Section. The DLL itself is free of that stuff, so it can be 
recompiled fine everywhere (please check my thread about CLX and indy in 
the socket group, I dunno what to do :( ).. The developer who will port 
  my code on another platform should only rewrite that small unit for 
loading the dll and its methods in a OS specific fashion.
So he can reinplement those functions EnterInThreadSafeCode and 
LeaveThreadSafeCode, in a specific way for his OS.
The DLL is free from that code :)
Hope thies way is correct.. I think I am doing what U say, cause only 
the console application is responsible for thread safe code, not my dll...
Thank You,
Best regards,
Stefano B.
Technical Details
Message-ID: <45cc2d10@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <45ca2bba@newsgroups.borland.com> <45ca3549@newsgroups.borland.com> <45ca373c$1@newsgroups.borland.com> <45ca50ae$1@newsgroups.borland.com> <45cae882@newsgroups.borland.com> <45cb6644@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7631859e1e5bf75d
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 09 Feb 2007 09:13:16 +0100
From: Stefano Bonifazi <stefboombastic@email.it>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Callback, Dll, Thread and synchronization HELP!
References: <45ca2bba@newsgroups.borland.com> <45ca3549@newsgroups.borland.com> <45ca373c$1@newsgroups.borland.com> <45ca50ae$1@newsgroups.borland.com> <45cae882@newsgroups.borland.com> <45cb6644@newsgroups.borland.com>
In-Reply-To: <45cb6644@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 80.104.235.19
Message-ID: <45cc2d10@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1171008784 80.104.235.19 (9 Feb 2007 00:13:04 -0800)
Lines: 33
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail