DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New] Link: http://www.fltk.org/str.php?L2642 Version: 1.3-feature Just some thoughts: We can easily change one or more test programs to link with the dll, and we should then document these as examples. I tested this with test/device, and it worked. The test programs /in our FLTK project/ I tested with dll linkage worked w/o explicitly specifying WinMain(), presumably because they /also/ link with the object library fltk.lib, and in this library for static linking we have our WinMain() stub that would normally be used for static linking. I don't yet know why this happens, but there seems to be an implicit dependency ("added by the system") that can't be removed. MS VC++ magic ? In user projects, created from an empty project, we would have to link with fltkdll.lib (only), but then we'd need an explicit WinMain() function provided by the user. One solution would be to link additionally with fltk.lib, so that the same applies as with our FLTK project test programs: they pull WinMain() from the static lib. I don't know whether this is good style, however, since it could come to ambiguities... Another solution could be another header file that the user would have to include to get rid of the need to write a WinMain() function. I just posted it in the above mentioned thread, but here it is again for completeness (code taken and from src/fl_call_main.c and stripped down to a minimum): FL/winmain.h: #ifdef FL_DLL #include <Windows.h> // int main (int, char **); // should probably not be here ? int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { return main(__argc,__argv); } #endif // FL_DLL So, yes, I agree with Greg. We need to decide what we should suggest and then we should document this. There was also a proposal to let the user change the program entry point to main(), but maybe this doesn't work as expected. A user (Asif) reported that the program didn't exit cleanly when he did that. This needs to be checked. And, last but not least, we could simply document that we provide the WinMain() function only for static linking, and that the user must call his program entry point WinMain(), just as MS wants him to do ;-) Link: http://www.fltk.org/str.php?L2642 Version: 1.3-feature _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
