Returning a string to C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Neo

    #1

    Returning a string to C#

    I have a Win32 dll project with the following function prototype:
    extern "C" __declspec(dlli mport) BROWSERAPI_API char* Browse(void);


    What I want to do is to return a string containing a path to C# using
    PInvoke.

    The C++ implementation code is something like this:
    char path[_MAX_PATH];

    // Do something...

    return path;

    When VS.NET2002 builds the solution, the following warning appears:

    warning C4172: returning address of local variable or temporary

    What can I do to prevent this warning from appear?
    Thank you very much




Working...