ricky_cpp
January 21st, 2009, 08:18 AM
Hello All,
I have imported a .dll into my C# project. One of the function in dll is:
extern "C" __declspec(dllexport) void SetCallbackProcAddr(long lProcAddress)
{
g_CallbackProc = (decodePacket)lProcAddress;
}
which takes address of function from client project.
In my client project, I am having :
namespace Client
{
Class useDLL
{
[DllImport("exampleDLL.dll", EntryPoint = "SetCallbackProcAddr", ExactSpelling = false, CharSet = CharSet.Unicode, SetLastError = true)]
public static extern unsafe void SetCallbackProcAddr(long* apPointer);
//And I would like to pass below's function address to above function
public void CallBack(IntPtr apData, int aDataSize)
{
}
//Function test is called from main
public void test()
{
Client.SetCallbackProcAddr(????????); //What should replace ?????????
}
//Has someone any idea how should I pass on address of CallBack function )
}
}
I am new to C# and want first to import my projects in form of dll. example.dll is one of the projects which is using c++ and c files.
Can someone be of help?
Thanks and regards,
Ricky
I have imported a .dll into my C# project. One of the function in dll is:
extern "C" __declspec(dllexport) void SetCallbackProcAddr(long lProcAddress)
{
g_CallbackProc = (decodePacket)lProcAddress;
}
which takes address of function from client project.
In my client project, I am having :
namespace Client
{
Class useDLL
{
[DllImport("exampleDLL.dll", EntryPoint = "SetCallbackProcAddr", ExactSpelling = false, CharSet = CharSet.Unicode, SetLastError = true)]
public static extern unsafe void SetCallbackProcAddr(long* apPointer);
//And I would like to pass below's function address to above function
public void CallBack(IntPtr apData, int aDataSize)
{
}
//Function test is called from main
public void test()
{
Client.SetCallbackProcAddr(????????); //What should replace ?????????
}
//Has someone any idea how should I pass on address of CallBack function )
}
}
I am new to C# and want first to import my projects in form of dll. example.dll is one of the projects which is using c++ and c files.
Can someone be of help?
Thanks and regards,
Ricky