C# -> C++ call issue

  • Thread starter Thread starter Jais Joy
  • Start date Start date
J

Jais Joy

Following is my issue.

-------------------------------------------

I have a unmanaged application ( C++ , .exe ) which has a class CMyClass
with a public member fMyFunct(). You can assume this C++ application is
built with /clr option.

I need to instantiate CMyClass in a different managed ( C# ) application and
call fMyFunct().

Many thanks if any of you can send me a sample which demonstrate above
things ( Remember I can't manipulate C++ application apart from project
settings. But you can do anything in C# application )

----------------------------------------------------
 
Jais,

Just using /clr should produce a managed executable for you. Because of
that, you should be able to set a reference to your executable from other
..NET code (as of .NET 2.0).

Are you creating CMyClass as a managed class, or an unmanaged class?
 
Nicholas Paldino said:
Jais,

Just using /clr should produce a managed executable for you. Because
of that, you should be able to set a reference to your executable from
other .NET code (as of .NET 2.0).

Mixed-mode executables can't be used as references, because the loader
tables necessary for fixups aren't present.
Are you creating CMyClass as a managed class, or an unmanaged class?
 
You have almost answered my question. Many thanks. Just another question.
Can I have a VC++ 6.0 executable with a managed ( C# ) dll loaded into it
which contains functions to instantiate certain classes in the executable?

Background of this is , I am trying to use unit test scripts generated with
/clr:safe option. I am thinking of generating some unit test scripts in
VS-2005 Team Edition with /clr:safe option ( although MFC application
compiles with errors , It generate unit test scripts ). I would like to use
these generated unit test scripts some how.

Thanks.

Ben Voigt said:
Nicholas Paldino said:
Jais,

Just using /clr should produce a managed executable for you. Because
of that, you should be able to set a reference to your executable from
other .NET code (as of .NET 2.0).

Mixed-mode executables can't be used as references, because the loader
tables necessary for fixups aren't present.
Are you creating CMyClass as a managed class, or an unmanaged class?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jais Joy said:
Following is my issue.

-------------------------------------------

I have a unmanaged application ( C++ , .exe ) which has a class CMyClass
with a public member fMyFunct(). You can assume this C++ application is
built with /clr option.

I need to instantiate CMyClass in a different managed ( C# ) application
and
call fMyFunct().

Many thanks if any of you can send me a sample which demonstrate above
things ( Remember I can't manipulate C++ application apart from project
settings. But you can do anything in C# application )
 
Back
Top