Mixed mode exe (forms application)

  • Thread starter Robert Ginsburg
  • Start date
R

Robert Ginsburg

I have created a .NET C++ forms application. I would like to call some
functions in an unmanged class that provides access to some underlying API
functions. The underlying class needs access to ATL (for example the CString
class). I created the app, added an unmanaged C++ class, changed the
compiler from /clr:pure to /clr. I added includes in stdafx.h . The system
compiles but fails during runtime (an assert fires on
_CrtIsValidHeapPointer ) apparently due to the fact that the ATL statics
are not initialized. According to
http://msdn2.microsoft.com/en-us/library/ms173267.aspx, I no longer need to
deal with _vcclrit.h or its idosynchrocises to make this work. However it
does not appear to work correctly.

Interestingly, if I create a Win32 project, and add a managed form to it,
all appears fine..

Any and all insight, pointers or help is appreciated

-Robert
 
J

Jochen Kalmbach [MVP]

Hi Robert!
I have created a .NET C++ forms application. I would like to call some
functions in an unmanged class that provides access to some underlying API
functions. The underlying class needs access to ATL (for example the CString
class). I created the app, added an unmanaged C++ class, changed the
compiler from /clr:pure to /clr. I added includes in stdafx.h . The system
compiles but fails during runtime (an assert fires on
_CrtIsValidHeapPointer ) apparently due to the fact that the ATL statics
are not initialized. According to
http://msdn2.microsoft.com/en-us/library/ms173267.aspx, I no longer need to
deal with _vcclrit.h or its idosynchrocises to make this work. However it
does not appear to work correctly.

Does the following help you?
http://msdn2.microsoft.com/ms235211

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
R

Robert Ginsburg

No, that link focuses on adding CLR support to unmanaged applications. Which
I am successfully able to do. What I want to do is the reverse, I want to
add an unmanaged class, with access to ATL, to a .NET forms application.
 
J

Jochen Kalmbach [MVP]

Hi Robert!
No, that link focuses on adding CLR support to unmanaged applications. Which
I am successfully able to do. What I want to do is the reverse, I want to
add an unmanaged class, with access to ATL, to a .NET forms application.

It should be the same settings, regardless in which direction you "move"...

Do you have a small project which can be used to repor this problem?

Greetings
Jochen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top