none
How send string/return string using ICLRRuntimeHost

    Question

  • Hi,
    I need to implement a native/managed process-dll communication using the  ICLRRuntimeHost interface.
    How can I get back from C# a string of characters (BSTR, TCHAR ...) by calling ExecuteInDefaultAppDomain() instead of a DWORD?
    Moreover, is there any other method of this interface allowing me to pass several arguments as string (that's just for commodity) and get back a string (that's imerative)?
    Many thanks!
    Friday, December 11, 2009 6:27 PM

Answers

All replies

  • Hello Opariti,

    Thanks for you post.

    As said in the document,

    "The invoked method must have the following signature:"

    So, it cannot be used to pass several arguments as string. I would like to suggest you try with C++\CLI, as it is designed as the bridge of the native and managed word.

    http://msdn.microsoft.com/en-us/magazine/dd315414.aspx

    Thanks,
    Rong-Chun Zhang
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com 

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, December 14, 2009 12:05 PM
  • Thanks,
    You are right - and I've written in my posting - about the method's limitation. My question was if there isn't another method of that interface to do more, but I didn't fidn and you confirm it.
    I finally solved the problem for the testing phase- I use a file to get back from the C# dll ...
    I have one question though: I'd have liked to use something like "shared memory" or "memory mapped file". It seems that the last one would work on the 4.0 version of .net.
    The customer is still 3.5 (in fact 2.0). Could you please advise me on a Microsoft solution available in-memory?
    Thanks!
    • Marked as answer by Opariti Wednesday, December 16, 2009 12:32 PM
    • Unmarked as answer by Opariti Wednesday, December 16, 2009 12:33 PM
    Tuesday, December 15, 2009 6:24 PM
  • Hello  Opariti,

    With "memory mapped file", did you mean the File Mapping objects? If so, please check the samples for IPC and RPC in our All-In-One Code Framework. It demonstrate how to use File mapping object to communicate between managed world and native world.

    http://cfx.codeplex.com/wikipage?title=All-In-One%20Code%20Framework%20Sample%20Catalog&referringTitle=Home

    Thanks,
    Rong-Chun Zhang
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com 

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Opariti Wednesday, December 16, 2009 12:33 PM
    Wednesday, December 16, 2009 9:46 AM