dllimport C++ DLL In VB.net
Posted
by
JFLow
on Stack Overflow
See other posts from Stack Overflow
or by JFLow
Published on 2010-12-29T05:39:58Z
Indexed on
2010/12/29
11:54 UTC
Read the original article
Hit count: 574
Hi Experts out there,
I'm stuck at dll imports with the c++ dll and i really need help to get over this.
Here is the function in the c++ dll that i want to call from my VB.net code.
bool LoadNewTestPlan(const char* szPlanFileName=" ");
I've tried many ways in my VB.net but always getting the error : "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
I have tried passing in byte(), Marshalling with LPStr, SafeArray and nothing works.
Here is the example of my code code within the module
<DllImport("HPVKIfc.dll", EntryPoint:="?LoadNewTestPlan@HPVKIfc@@QAE_NPBD@Z", CharSet:=CharSet.Ansi)> _
Public Function LoadNewTestPlan(<MarshalAs(UnmanagedType.LPStr)> ByVal pln As String) As Boolean
End Function
Do you see anything wrong?
Thanks in advance.
© Stack Overflow or respective owner