473,322 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

static managed member in unmanaged code

Is it possible to declare a static managed member in managed code?

gcroot<MyClass*> instance
works,
but
static gcroot<MyClass*> staticinstance does not.

Any suggestions?
Nov 17 '05 #1
3 2554
Correction: Is it possible to declare a static managed member in UNMANAGED
code?
"Kl***@noemail.nospam" wrote:
Is it possible to declare a static managed member in managed code?

gcroot<MyClass*> instance
works,
but
static gcroot<MyClass*> staticinstance does not.

Any suggestions?

Nov 17 '05 #2
Hi Klynt,
Correction: Is it possible to declare a static managed member in
UNMANAGED code?


AFAIK, the gcroot is used to wrapped an managed object in a unmanaged
object(class), but the code of gcroot<...> declaration should be compiled
as managed code, for the gcroot copy constructor needs to create a new GC
handle and use managed types and call managed functions.
Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default...sdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #3
By the way, do you mean is it possible to declare a static managed member
in UNMANAGED object(class) and instance it
like the following code snippet:

class UnManagedClass {
public:
CppClass() {}

static gcroot<String*> str;
};
...
UnManagedClass::str = new String("Hello");

Then I think you will get the LNK2020 : unresolved token error while
compiling the above code, if you still monitor this thread and have concern
on the problem, please reply this message and I will contact the
corresponding support specialist for you.
Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default...sdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andre | last post by:
Hi, I have a static Lib and I want to use it in C#. So, I tried to wrap these functions in a DLL (not in a class) and use . But this doesn't work. Is it possible to wrap this in a DLL not...
1
by: Eric Twietmeyer | last post by:
Hello, I'm starting to investigate cs, managed c++ and interoperating with a very large unmanaged code base. We are going to use Windows Forms (written in cs) to replace our old fashioned GUI. ...
6
by: mflanagan | last post by:
I have unmanaged C++ program that will load a managed C++ dll and then call a function in that dll. The managed C++ routine will call some C# routines. The unmanaged C++ main program will make...
7
by: Lev | last post by:
Hi, I have an unmanaged pointer to a class that I want to hold in a managed class. I pass the pointer (from unmanaged code) in the constructor of the managed class, and at that point it has...
2
by: Martin Zenkel | last post by:
Dear VS Team, using the Beta 2 of VS 2005 I've encontered the following problem. Let's assume threre are three Dll's, one unmanaged and two managed. In the unmanaged we put a simple unmanged...
3
by: Thorsten | last post by:
HI I'm a C# developer and unfortunately I have to write now some code in managed and unmanaged C++. In this area I'm Newbie and therefore please forgive me if this is a really simple...
12
by: Haxan | last post by:
Hi, I have my main application class(unmanaged) that has a none static member function that I need to pass as a delegate to managed C# method. In one of the methods of this class(unmamanged),...
6
by: Stephen Walch | last post by:
Our application environment consists of three basic layers: 1. Third-party unmanaged DLLs that were written before the CLR was invented and maintain a significant amount of information (including...
3
by: Pixel.to.life | last post by:
Hi, Gurus, I recently attempted to build a .Net forms application, that links with old style unmanaged C++ static libs. Of course I had to recompile the static lib projects to link properly...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.