sure first look into CreateFileMapping. Theres a couple of concerns
1. the name must be mIRC
2. the size must be 1024 or larger.
youll recieve a handle use that handle in a call to MapViewOfFile. this will return a pointer you can use as a char array (LPCSTR).
fill that pointer with whatever "script" code you want mIRC to do and send the message to mIRC. the message will vary depending on if the text is an identifier or a command (the actual values for the messages are in the help file under SendMessage).
In the case of an identifier mIRC will fill the pointer with whatever is returned for your dll to examine. The following code was ripped from an sdk of mine (only the relavent portions)
//the message identifiers
#define WM_EVALUATE ((WM_USER) + 201)
#define WM_MCOMMAND ((WM_USER) + 200)
//the handle and data pointer
HANDLE hFileMap;
LPSTR mData;
//typically place this in the LoadDll or DllMain functions
hFileMap = CreateFileMapping(INVALID_HANDLE_VALUE,0,PAGE_READWRITE,0,
0x4000,"mIRC");
mData = (LPSTR)MapViewOfFile(hFileMap,FILE_MAP_ALL_ACCESS,0,0,0);
//now fill some info for mirc to do. in this case an identifier
wsprintf(mData,"$window(*,0)");
//tell mIRC to evaluate this for us. mwnd is mIRCS main window handle
SendMessage(mwnd,WM_EVALUATE,0,0);
//get the total window count. mData holds whatever was returned by mIRC
int nWndCount = atoi(mData);
//this time make mIRC perform a command
wsprintf(mData,"/echo -a hello me");
SendMessage(mwnd,WM_MCOMMAND,0,0);
//continue using mData as long as you want.
//in your DllMain functions DLL_PROCESS_DETACH case statement or in the UnloadDll function use this to clean up
UnmapViewOfFile(mData);
CloseHandle(hFileMap);
Its very easy to see how you can implement callbacks. your dll remains loaded and can send and recieve info with mIRC at anytime not just during a /dll call. You could even send a /signal if you want just remember that signals do not return values so its a one way comm only.
Note i havent shown any error checking in the code above but im sure youll be able to get it up and running