Home All Groups Group Topic Archive Search About

Assembly initializer.

Author
11 Jul 2006 2:42 PM
Ken Varn
Is there anyway to write an assembly DLL that has an initializer that is
automatically called before any other methods in the assembly?  I am
thinking along the lines of a DllMain similar to that which is in standard
C++ DLLs.


--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

Author
11 Jul 2006 9:32 PM
Mattias Sjögren
Ken,

>Is there anyway to write an assembly DLL that has an initializer that is
>automatically called before any other methods in the assembly?  I am
>thinking along the lines of a DllMain similar to that which is in standard
>C++ DLLs.

The CLR supports such a feature starting with 2.0, but it also
requires language support. IL Assembler, and I believe also C++, lets
you define module initializers, but other languages such as C# and VB
do not.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
12 Jul 2006 1:12 PM
Ken Varn
I am using managed C++.  Can I use a DllMain in C++ with the 1.1 Framework?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
Show quote
"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:%23bNIbFTpGHA.4268@TK2MSFTNGP04.phx.gbl...
> Ken,
>
> >Is there anyway to write an assembly DLL that has an initializer that is
> >automatically called before any other methods in the assembly?  I am
> >thinking along the lines of a DllMain similar to that which is in
standard
> >C++ DLLs.
>
> The CLR supports such a feature starting with 2.0, but it also
> requires language support. IL Assembler, and I believe also C++, lets
> you define module initializers, but other languages such as C# and VB
> do not.
>
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP]  mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.

AddThis Social Bookmark Button