none
Marshal Function pointer from C# to C++ RRS feed

  • Question

  • Hi all,

     

    I have a C++ dll To which I need to pass callback function pointer.

     

    by search I got results which says marshalling from managed cpp files to unmanaged cpp lib

    http://msdn2.microsoft.com/en-us/library/ektebyzx(VS.80).aspx

     

    The same method I tried for .cs C# files but it says gcnew, pin_ptr all these not available in current context.

    I have included system & system.runtime.interopservices namspaces.

     

    What is wrong?

     

    pls help

     

    Regards

    KKR

     

     

     

    Friday, February 15, 2008 10:29 AM

Answers

  • The example is for Visual C++, not for C#.

    So you're trying to copy a bunch of managed C++ code in to C# source and try to compile it.

    Check out How to: Implement Callback Functions which demonstrate how a managed application, using platform invoke, can print the handle value for each window on the local computer.
    Monday, February 18, 2008 1:20 PM