FORUMS: list search recent posts

Error during marshaling in C# project to access KONA card SDK

COW Forums : AJA Video Systems

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Uday Mahajan
Error during marshaling in C# project to access KONA card SDK
on Dec 16, 2015 at 12:15:28 pm

Hi,

We are using marshaling to call AJA Kona card’s SDK C++ functions to C#.Net

For marshaling we used the code to call functions are as below,

const string _dllLocation = @"E:\UdayWork\WpfTestCPPDLL\WpfTestCPPDLL\bin\Debug\classesDLL_64d.dll";

[DllImport(_dllLocation, EntryPoint = "?GetDisplayName@CNTV2Card@@UEAA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]

public static extern string GetDisplayName();

From main app, we are accessing as,

string str = GetDisplayName();

getting error as
An exception of type 'System.AccessViolationException' occurred in WpfTestCPPDLL.exe and wasn't handled before a managed/native boundary

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt

Please let us know, how to call functions from DllImport?

Regards

Uday


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]