Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling C++ dll from C# - how to debug?
Message
From
21/10/2017 07:52:16
 
General information
Forum:
C#
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01655067
Message ID:
01655134
Views:
74
This message has been marked as the solution to the initial question of the thread.
>I got it to work! Thanks a million for your help.
>
>This is how it's declared now:
>
>
> [DllImport(@"C:\Program Files (x86)\Siriusware\Pool\ww_local.dll",
>            ExactSpelling = false,
>            CallingConvention = CallingConvention.Cdecl,
>            CharSet = CharSet.Ansi)]
>        static extern IntPtr Invoke1( String str);
>
>
>And this is how I call it:
>
>  translate = Marshal.PtrToStringAnsi(Invoke1(invoke));
Good.

That how a string is returned
The dll returns a pointer to a string, hence IntPtr in the declaration
Once it returns, you create a string with PtrToStringAnsi
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform