0

I have got c++ function with export looking like this:

extern "C" __declspec(dllexport) LPCWSTR Function(void)

But cannot get answer from it in vb.net. Always get error that memory is corrupted.

I can alredy execute imported code like this:

extern "C" __declspec(dllexport) int Function2(wchar_t*)

Can some one help with this?

#

Already found solution.

For my template it looks like:

    <DllImport(DllName)>
    Protected Shared Function Function() As IntPtr
    End Function

    Public Shared Function AliasForFunction() As String
        Return Marshal.PtrToStringAuto(Function())
    End Function

0 Answers0