static initialisers in mixed-mode DLLS 
Author Message
 static initialisers in mixed-mode DLLS

I see that in VS.NET 2003, there is now a recommended way
to build mixed-mode DLLs that contain static C++ objects
so that the constructors and destructors of these objects
get called. (link with /noentry, force include
__DllMainCRTStartup and expose initialization and
termination methods)

While this does fix an existing problem (where C++
destructors never get called), this is pretty ugly since
the DLL now has to provide an initialize and terminate
method that clients must call. Couldn't there have been a
better way of doing this?

  Andrew



Fri, 21 Oct 2005 22:48:17 GMT  
 static initialisers in mixed-mode DLLS

Quote:

> I see that in VS.NET 2003, there is now a recommended way
> to build mixed-mode DLLs that contain static C++ objects
> so that the constructors and destructors of these objects
> get called. (link with /noentry, force include
> __DllMainCRTStartup and expose initialization and
> termination methods)

> While this does fix an existing problem (where C++
> destructors never get called), this is pretty ugly since
> the DLL now has to provide an initialize and terminate
> method that clients must call. Couldn't there have been a
> better way of doing this?

This is a stop-gap solution to a problem that was only fully understood very
late in the VS.NET 2003 beta cycle.  Expect to see a better solution in the
future.

-cd



Fri, 21 Oct 2005 23:48:29 GMT  
 static initialisers in mixed-mode DLLS
Glad to hear it's being addressed although I did report
this issue a very long time ago against VS.NET 2002

Presumably the future means another year :) is there any
chance that this could be addressed in the upcoming
service pack (I'd be happy if anyone from MS could
contact me privately)
  Thanks
    Andrew

Quote:
>-----Original Message-----

>> I see that in VS.NET 2003, there is now a recommended
way
>> to build mixed-mode DLLs that contain static C++
objects
>> so that the constructors and destructors of these
objects
>> get called. (link with /noentry, force include
>> __DllMainCRTStartup and expose initialization and
>> termination methods)

>> While this does fix an existing problem (where C++
>> destructors never get called), this is pretty ugly
since
>> the DLL now has to provide an initialize and terminate
>> method that clients must call. Couldn't there have
been a
>> better way of doing this?

>This is a stop-gap solution to a problem that was only

fully understood very
Quote:
>late in the VS.NET 2003 beta cycle.  Expect to see a

better solution in the

- Show quoted text -

Quote:
>future.

>-cd

>.



Sat, 22 Oct 2005 00:22:22 GMT  
 static initialisers in mixed-mode DLLS

Quote:
> Presumably the future means another year :) is there any
> chance that this could be addressed in the upcoming
> service pack (I'd be happy if anyone from MS could
> contact me privately)

No, this requires massive changes in several places.

Ronald Laeremans
Visual C++ team


Quote:
> Glad to hear it's being addressed although I did report
> this issue a very long time ago against VS.NET 2002

> Presumably the future means another year :) is there any
> chance that this could be addressed in the upcoming
> service pack (I'd be happy if anyone from MS could
> contact me privately)
>   Thanks
>     Andrew

> >-----Original Message-----

> >> I see that in VS.NET 2003, there is now a recommended
> way
> >> to build mixed-mode DLLs that contain static C++
> objects
> >> so that the constructors and destructors of these
> objects
> >> get called. (link with /noentry, force include
> >> __DllMainCRTStartup and expose initialization and
> >> termination methods)

> >> While this does fix an existing problem (where C++
> >> destructors never get called), this is pretty ugly
> since
> >> the DLL now has to provide an initialize and terminate
> >> method that clients must call. Couldn't there have
> been a
> >> better way of doing this?

> >This is a stop-gap solution to a problem that was only
> fully understood very
> >late in the VS.NET 2003 beta cycle.  Expect to see a
> better solution in the
> >future.

> >-cd

> >.



Tue, 25 Oct 2005 09:04:59 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Mixed-mode dll and ASP.Net

2. mixed mode DLL causing non-continuable exception during process load

3. COM and Mixed Mode DLL

4. Mixed Mode DLL Issues?

5. ATL dll cannot link to static library in release mode

6. Linking Static DLL vs Non Static DLL

7. mixed mode debugger hanging

8. Mixing ATL threading modes?

9. Mixing real- and protected-mode code

10. Mixing Portrait and Landscape in Duplex mode

11. Mixing MFC Extension DLL's with Regular DLL's

12. Mixing static and dynamic MFC runtime

 

 
Powered by phpBB® Forum Software