I have an MFC Extension DLL that I have flicked the /clr switch on and made a
few other tweaks so it compiles and runs in a managed MFC applicaiton.
The DLL contains a number of classes which contain static member variables
and static methods. Are these permitted in a managed DLL?
Thanks
Colin
JAL - 26 Nov 2005 03:30 GMT
Colin... All I can say is that MSIL understands static (class) methods and
variables so that you can certainly declare and use static member methods and
variables in a purely managed language as C#. C# does not support static
local variables. I don't (yet) have any C++/cli code for this so this is C#:
class TestStatic
{
// static stuff
private static int uniqueID= 0;
private static int GetUniqueID()
{
lock(typeof(TestStatic))
{
return uniqueID++; // returns zero at start
}
}
// member stuff
private int identity;
public TestStatic()
{
this.identity= TestStatic.GetUniqueID();
}
public int Identity
{
get
{
return identity;
}
}
}
> I have an MFC Extension DLL that I have flicked the /clr switch on and made a
> few other tweaks so it compiles and runs in a managed MFC applicaiton.
[quoted text clipped - 5 lines]
>
> Colin
Marcus Heege - 28 Nov 2005 15:16 GMT
I have done quite a lot with /clr so far, and I have not seen problems with
static member variables of native types so far.
Marcus Heege
>I have an MFC Extension DLL that I have flicked the /clr switch on and made
>a
[quoted text clipped - 6 lines]
>
> Colin
Colin Desmond - 29 Nov 2005 20:01 GMT
Marcus,
Thanks for this support, turns out my problems lay elsewhere.
Thanks again
Colin
> I have done quite a lot with /clr so far, and I have not seen problems with
> static member variables of native types so far.
[quoted text clipped - 11 lines]
> >
> > Colin