[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnustep-objc (mingw): problem when using objc as dll
From: |
Helge Hess |
Subject: |
Re: gnustep-objc (mingw): problem when using objc as dll |
Date: |
Thu, 26 Apr 2001 15:54:35 +0200 |
Hi,
Michael Scheibler wrote:
> On WIN32 every shared library (DLL) is something very similar to an
> application. At least it has to be linked. Therefore it is necessary to have
> the Objective-C runtime as a shared library, to ensure that a dynamically
> loaded bundle does not use its own class tree but the same as the
> application.
This is correct. Never mix DLLs and static libs on Windows, this will
break badly.
> But... what if you have two objc applications? They must not have the same
> class tree.
> AFAIK every dll has its own - process independent - memory. This would mean
> that there will be a conflict resulting in... I don't know, but propably
> nothing good.
No. Every dll *can have* it's own, process independend (shared) memory.
By default the usual global/static variables should be stored in a
process private segment (which is created if the process attaches to the
DLL).
I'm not 100% sure, but 95% ;-)
> In gnustep-objc there is a file named libobjc_entry.c which implements
> DllMain. The purpose of DllMain is to do exactly these intializing steps
> when a new process/thread attaches/detaches. But look at the code:
>
> libobjc_entry.c
>
> WINBOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call,
> LPVOID lpReserved)
...
> There is nothing done. I think it is absolutely necessary to create a new
> class tree for each process.
I don't think so, since the class tree is stored in global variables and
the proper process private segments are assigned by NT automagically.
> Another thing I have to mention: in gnustep-objc/GNUmakefile there is
> following entry:
>
> ifeq ($(GNUSTEP_TARGET_OS), cygwin)
> extra_C_FILES=libobjc_entry.c
> else
> extra_C_FILES=
> endif
>
> But I didn't find anything for mingw32...
I think that the DllMain isn't necessary at all (it's optional if you
want to do make an 'intelligent' DLL which tracks processes and
threads).
Note: All the above should be true for NT/W2k, I'm not sure about Win
95,98,Me.
Greetings
Helge
--
SKYRIX Software AG - http://www.skyrix.com/
Web Application Technology for Enterprises