I have to replace a DLL in an old project. This project can't be changed (downward compatibility, other producer etc) and has the following Methodsignature:
typedef UINT(*CALLBACK Initialise)();
Initialise fp_initialise;
typedef UINT(*CALLBACK ReadPosition)(int *ptr_ncolours, float *ptr_pderrs, float *ptr_cderrs);
ReadPosition fp_readposition;
and so on...
where CALLBACK
is __stdcall
My C# DLL Interface:
[Guid("00005D2D-ABCD-3214-5694-A4EC0005B4D9")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
[ComVisible(true)]
public interface IMainInterface
{
int Initialise();
unsafe int ReadPosition(ref int ptr_ncolours, float* ptr_pderrs, float* ptr_cderrs);
//...
}
and the Class where I use the Interface:
[ClassInterface(ClassInterfaceType.None)]
[Guid("04991247-ABCD-ABCD-A4B8-3533D2F264D0")]
[ComVisible(true)]
[ProgId("MyDLL.Main")]
public class Main : IMainInterface
{
//...
}
The call of Initialize (it has no parameters) in my new C# dll works, but any other methodcalls crashs without any information.
How I have to write those Methods in my C# dll, when I call it from a C++ application, when I replace the old dll with my new C# dll?