Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

C# -> C++ call issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jais Joy - 22 Feb 2008 06:30 GMT
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 )

----------------------------------------------------
Nicholas Paldino [.NET/C# MVP] - 22 Feb 2008 13:29 GMT
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?

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Following is my issue.
>
[quoted text clipped - 13 lines]
>
> ----------------------------------------------------
Ben Voigt [C++ MVP] - 22 Feb 2008 19:05 GMT
> 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?
>
[quoted text clipped - 15 lines]
>>
>> ----------------------------------------------------
Jais Joy - 25 Feb 2008 05:33 GMT
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.

> > Jais,
> >
[quoted text clipped - 24 lines]
> >>
> >> ----------------------------------------------------

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.