Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling C++ dll from C# - how to debug?
Message
 
 
À
20/10/2017 08:30:51
Information générale
Forum:
C#
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01655067
Message ID:
01655109
Vues:
42
>The only thing I can think of is
>
>Changed
>(1) CallingConvention.StdCall
>(2) Use IntPtr for the dll return value, then convert IntPtr to string
>
>
> //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.StdCall, 
>            CharSet = CharSet.Auto)]
>        static extern IntPtr Invoke1([MarshalAs(UnmanagedType.LPTStr)] String str);
>
>
>
>


>then
>
>string translate  = Marshal.PtrToStringAuto(Invoke1(invoke));
>
>return translate ;
>
Thanks a lot, I'll try that. I still think the issue is inside the newer version of that C++ dll, so I may need help from our C++ developers to find out. But I'll try your suggestion with both new and old dll.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform