L prefix for strings in C++

前端 未结 5 1568
遇见更好的自我
遇见更好的自我 2021-01-05 10:45

I have a static library. This library have the following function defined

int WriteData(LPTSTR s)

The sample to call the function is

5条回答
  •  攒了一身酷
    2021-01-05 11:00

    Try:

    [DllImport("Test.dll")]
    private static extern int TestFun([MarshalAs(UnmanagedType.LPTStr)] string s);
    

    More information on marshaling with the MarshalAsAttribute on MSDN.

提交回复
热议问题