Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling C++ dll from C# - how to debug?
Message
 
 
À
Tous
Information générale
Forum:
C#
Catégorie:
Code, syntaxe and commandes
Titre:
Calling C++ dll from C# - how to debug?
Divers
Thread ID:
01655067
Message ID:
01655067
Vues:
67
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform