I've finally managed to send a pointer to my DLL :).
I am a little inspired me a
carousel source code.
My code is something like this:
In the DLL callback's API:
using System.Runtime.InteropServices;
namespace MyDLL
{
public class myDLL
{
[DllImport("MyDLL.dll")]
public static extern bool SetProcHandler([MarshalAs(UnmanagedType.FunctionPtr)] MyProc pfMyProc);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate int SendProc(int Prm1, int Prm2);
}
}
In the main program:
using MyDLL
namespace MyProgram
{
public partial class Principale : Form
{
static MyDLL.SendProc myProc = null;
public Principale()
{
InitializeComponent();
myProc = new MyDLL.SendProc(MyProc);
MyDLL.SetProcHandler(myProc);
GC.KeepAlive(myProc);
}
public unsafe int MyProc(int Prm1, int Prm2)
{
return 0;
}
}
}
I'm still a little test to see if it that generates not errors :~.
I hope that it can still be useful to someone :-D.