About Non-Managed Code and Managed Code.

  • Thread starter Thread starter Kevin Sun
  • Start date Start date
K

Kevin Sun

I have a problem about non-managed code and managed code.Could you like to
give me some suggestion?

In a non-managed MFC application project, I add some managed codes and
these files are setted into /clr:oldSyntax. But the problem is that when the
debug exits, the non-managed object CApplicationApp(maybe all the global and
static objects)'s ~ctor is called twice.

In fact the managed code only is a function without any statement and is
never called.

I have been investigating for sereval days but haven't found any cause
or solution.

Could you help me? Thanks.

Good Luck.

Kevin Sun.
 
Kevin Sun said:
I have a problem about non-managed code and managed code.Could you like to
give me some suggestion?

In a non-managed MFC application project, I add some managed codes and
these files are setted into /clr:oldSyntax. But the problem is that when
the debug exits, the non-managed object CApplicationApp(maybe all the
global and static objects)'s ~ctor is called twice.
Can't help, but I'm seeing something which may be related. I have multiple
C++/CLI assemblies loaded into a C# application. When the application
exits, it crashes, saying the CRT has been initialized multiple times.
 
Your problem maybe is the same as mine.
My MFC project in which there managed c++ code loads managed c++ DLL. When
the application exits, it crashed. I only see the CApplicationApp's ctor()
is called once, but the ~ctor() is called twice.
But if the MFC project doesn't load managed c++ DLL, or there is not managed
project in the MFC project, the application works well.
 
Back
Top