Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling C++ dll from C# - how to debug?
Message
 
 
To
All
General information
Forum:
C#
Category:
Coding, syntax and commands
Title:
Calling C++ dll from C# - how to debug?
Miscellaneous
Thread ID:
01655067
Message ID:
01655067
Views:
69
Hi everybody,

This is how the function is declared in C# (see VFP declaration in a comment - it works fine from VFP):
 //declare string Invoke1 in (addbs(justpath(.cProgramPath)) + "ww_local.dll") as ww_localInvoke string cInvokeString

        [DllImport(@"C:\Program Files (x86)\Siriusware\Pool\ww_local.dll", 
            ExactSpelling = false, 
            CallingConvention = CallingConvention.Cdecl, 
            CharSet = CharSet.Auto)]
        static extern String Invoke1([MarshalAs(UnmanagedType.LPTStr)] String str);
And then in the C# code I try to do
translate = Invoke1(invoke);
and then the C# test stops and I see a dmp file generated.

If I try to open that file in VS 2015 and debug in mixed mode I get

Unhandled exception at 0x777F9D71 (ntdll.dll) in vstest.executionengine.x86.exe.13284.dmp: 0xC0000374: A heap has been corrupted (parameters: 0x7782D8D0).

What can I do to figure out what may be a problem and why it works from VFP but not C#?

Thanks a lot in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform