Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums AJA Video Systems Error during marshaling in C# project to access KONA card SDK

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

    Posted by Uday Mahajan on December 16, 2015 at 12:15 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

    Uday Mahajan replied 10 years, 6 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy