-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/24/2010 01:50, Luis Lavena wrote: > On Sat, Oct 23, 2010 at 12:49 PM, JonY <jo...@users.sourceforge.net> wrote: >> >> Hello, >> >> you should use a callback to set a pointer to your function in your >> executable. >> >> You don't need to link to your executable. > > Understood JonY, and is the same answer you gave me over #mingw. But > the problem is that doing that way will require extensive > modifications on how plugins are compiled and how the main program is > compiled too. > > These differences will make hard keep a portable way, as these plugins > might be compilable under Linux/OSX or even cross-compiled for > Windows. > > Seems that the only path is modifying the program to generate a shared > library to link against it.
Relying on platform features such as having undefined symbols in an executable is already non-portable. Linking the executable to the DLL defeats the purpose of using a DLL. You would have to relink every time you wanted to use your DLL with another executable. You can just implement some sort of get/set method to setup your callbacks. See <http://www.newty.de/fpt/index.html> for more details on how to use function pointers. Another way to solve the dependency issue is to use LoadLibrary and GetProcAddress. Something like: Hdll = LoadLibrary("Myexe.exe"); functionpointer = GetProcAddress(Hdll, "MySymbol"); functionpointer(); It is similar to unix dlopen and dlsym. LoadLibrary and GetProcAddress usage info: <http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx> <http://msdn.microsoft.com/en-us/library/ms683212%28v=VS.85%29.aspx> -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (MingW32) iEYEARECAAYFAkzDgSwACgkQp56AKe10wHcOQgCglPf4tBMYFoh6Z6M6qMffucXv 6bUAnRUnZBz5oS0WCqUqBtsUmSGH93YJ =pvwY -----END PGP SIGNATURE-----
0xED74C077.asc
Description: application/pgp-keys
------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public