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 / .NET Framework / CLR / December 2007

Tip: Looking for answers? Try searching our database.

Experience hosting the CLR from native c++ ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave Farquharson - 19 Nov 2007 18:23 GMT
Hello,

I am trying to find good information on hosting the CLR from my native c++
program. I'm successfully using CorBindToRuntimeEx to host the CLR and
executing functions in a test CLR assembly using ExecuteInDefaultAppDomain.
That's all great, but my problem is that the execute function seems rather
limited. It accepts a string argument and returns an int, and that's it.

So my question is, how can more information about state be passed back and
forth between the assembly and the hosting program? I've exercised my search
engine pretty heavily looking for examples and I keep thinking, there must
be a way to share data! Anyone successfully done this or have info about it?

Thanks in advance,

-Dave
Chris Mullins [MVP - C#] - 19 Nov 2007 18:41 GMT
There's a book out that goes into great detail on hosting the CLR:

"Customizing the Microsoft® .NET Framework Common Language Runtime"
http://www.microsoft.com/mspress/books/6895.aspx

Signature

Chris Mullins

> Hello,
>
[quoted text clipped - 14 lines]
>
> -Dave
Dave Farquharson - 19 Nov 2007 18:52 GMT
Hi Chris,

Thank you for your reply. Interesting you brought up this book; I ordered it
on Friday and should get it tomorrow, unless UPS fails me :)  Thought I'd
take a crack on getting info today though while I wait, on this part of the
subject anyway.

Thanks again,

-Dave

> There's a book out that goes into great detail on hosting the CLR:
>
[quoted text clipped - 19 lines]
>>
>> -Dave
Keith Hall - 03 Dec 2007 03:31 GMT
Hello Dave,

Have you yet looked at defining "#pragma managed" and "#pragma unmanaged" sections of code in C++? You can use these to generate a "mixed-mode" DLL which you can then load from C++.

This approach seems to work fine, although apparently NOT when the calling C++ is in a native lib loaded by Java JNI. Am trying to find out why...

Regards,

Keith

EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com
Dave Farquharson - 03 Dec 2007 18:09 GMT
Hello Keith and thanks for the message.

No, I have not tried that yet. I did get Steven Pratschner's book on CLR
customization, and it's a valuable reference for anyone interested in
hosting the CLR and creating app domains. I have things working almost like
I want, the last piece being communication back to the native host from the
managed assemblies. I will probably take a look at the pragmas you mention
though.

Thanks again!

-Dave

> Hello Dave,
>
[quoted text clipped - 11 lines]
> EggHeadCafe - .NET Developer Portal of Choice
> http://www.eggheadcafe.com

Rate this thread:







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.