AHA! I've FINALLY figured it out (thanks to google of course)...
In case you're wondering:
file:new:projects-MFC AppWizard (dll):finish(accept defaults)
do normal dialog stuff. put any free function implementations in the dll's .cpp file and the function name in the .def file. Most importantly the first line of any free function implementation must be: AFX_MANAGE_STATE(AfxGetStaticModuleState());
ie, in MainDllFile.cpp append:
Code:
void doDialog() {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CTheDialog dlg;
dlg.DoModal();
}
in MainDllFile.def:
Code:
; Explicit exports can go here
doDialog
then in the app using the dll, #include a file that contains the following or just type it into the files that use the func:
extern void doDialog();
==or==
__declspec(dllimport) void doDialog();
Then you can call it. Alternately you can exlude the .def entry and just use a header that both the dll and app can include which contains something like:
Code:
#ifndef _EXPORT_H_
#define _EXPORT_H_
#ifdef THE_DLL// the dll should define this before inclusion
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
DLLEXPORT void doDialog();
#ifdef __cplusplus
}
#endif
#endif //_EXPORT_H_
That's it (yeah, after 4 days of trying)!!!