calling dll with callback from windows/linux

I want to call a dll from windows.

it would have stand “C” inteface,and allows me to

extern “C” ConnectandFetch(char* pHost,int Port, callback_ptr1,callback_ptr2); //this would make a thread innner.

well,I don’kt know how to use the callback ,so that when the data comming.

the main.exe made by XOJO could fire the callback well?

what if I use the second way?

I build a console program with the DLL name “test.exe” ,and use IPCsocket to connect my main.exe?

Call the method using declare, setting the parameter of the callback to

AddressOf FunctionToBeCalledByDLL

can this invoke the callback in the dll’s thread??

it’s better to do this in calllback… or I will consider using socket if no other advise…