I\'m trying to call an function in an unmanaged c++ dll in .net cf 3.5 in a windows ce 6.0 environment.
The struct is defined as:
typedef struct TagO
You can only call functions that have been exported as C style functions. As far as I am aware you cannot call straight C++ functions via P/Invoke, e.g.:
How to set up a C++ function so that it can be used by p/invoke?
Update
Actually, it does appear you can use mangled names when calling a function via P/Invoke. This is something I could never get working in the past, so I stand corrected. Using names rather than ordinals should be more resilient too:
Reference: Entry Point Not Found Exception
So something like:
[DllImport(gsmaAdapterDLLName,
EntryPoint="?GetCurOperatorInfo@CGSMAdapter@@YAHPAUTagOperatorInfo@@@Z",
ExactSpelling = true,
CallingConvention = CallingConvention.Cdecl)]
public static extern bool GetCurOperatorInfo(out TagOperatorInfo info);
And for .Net CF:
DllImport(gsmaAdapterDLLName,
EntryPoint="?GetCurOperatorInfo@CGSMAdapter@@YAHPAUTagOperatorInfo@@@Z",
CallingConvention = CallingConvention.WinApi)]
public static extern bool GetCurOperatorInfo(out TagOperatorInfo info);