Hi all,
I'd appreciate some help with building a plugin for Windows. The plugin generates and compiles fine; the problem is at the link stage. I don't know how to configure the make so that it links the plugin with a library that it requires. I've searched the web but I haven't been able to find anything that covers this specifically. Any pointers you can give me would be welcomed.
Thanks,
--John
John Daniels
2009/4/27 John Daniels jd@syntropy.co.uk:
Hi all,
I'd appreciate some help with building a plugin for Windows. The plugin generates and compiles fine; the problem is at the link stage. I don't know how to configure the make so that it links the plugin with a library that it requires. I've searched the web but I haven't been able to find anything that covers this specifically. Any pointers you can give me would be welcomed.
You need to add an option to linker in your plugin makefile like: -lmyimportlibrary
and to generate import library, please read this page: http://oldwiki.mingw.org/index.php/CreateImportLibraries
i hope it helps.
Thanks,
--John
John Daniels
On 27.04.2009, at 12:23, Igor Stasenko wrote:
2009/4/27 John Daniels jd@syntropy.co.uk:
Hi all,
I'd appreciate some help with building a plugin for Windows. The plugin generates and compiles fine; the problem is at the link stage. I don't know how to configure the make so that it links the plugin with a library that it requires. I've searched the web but I haven't been able to find anything that covers this specifically. Any pointers you can give me would be welcomed.
You need to add an option to linker in your plugin makefile like: -lmyimportlibrary
and to generate import library, please read this page: http://oldwiki.mingw.org/index.php/CreateImportLibraries
A common way is to link the required library statically. That way your users do not have to worry about dependencies, installing DLLs with the right versions etc. To do that, add the mylibrary.a file to the linker command line.
- Bert -
A common way is to link the required library statically. That way your users do not have to worry about dependencies, installing DLLs with the right versions etc. To do that, add the mylibrary.a file to the linker command line.
That's what I'd like to do but I don't have a makefile for my plugin, or at least, I haven't created one. It just seems to get made automatically. What would be in such a makefile, and where would I put it? The default makefile (assuming that's what's being used) is mostly doing what I want except for the specification of the extra library.
Sorry to be such a dunce!
Thanks again,
--John
2009/4/27 John Daniels jd@syntropy.co.uk:
A common way is to link the required library statically. That way your users do not have to worry about dependencies, installing DLLs with the right versions etc. To do that, add the mylibrary.a file to the linker command line.
That's what I'd like to do but I don't have a makefile for my plugin, or at least, I haven't created one. It just seems to get made automatically. What would be in such a makefile, and where would I put it? The default makefile (assuming that's what's being used) is mostly doing what I want except for the specification of the extra library.
Sorry to be such a dunce!
Just add a 'makefile' file to the directory where platform files of plugin are located (platforms/win32/plugins/YourPluginName/makefile)
here an example of makefile, for freetype plugin: --------------- include ../../Makefile.plugin
# This seems broken, but in the generated FT2Plugin.c there is an # include<tttables.h> which should be include<freetype/tttables.h> # so we simply add it to the include path. Eeek. INCLUDES+= -I$(WIN32DIR)/freetype
# Add the freetype libs to the build EXTRALIBS=$(WIN32DIR)/freetype.a -----------------
Thanks again,
--John
Thanks Igor, that was exactly the information I needed.
--John
==== Original message From: Igor Stasenko siguctua@gmail.com Date: 27 April 2009 Time: 12:39:42 PM Subject: [squeak-dev] Linking a plugin with a library ---- 2009/4/27 John Daniels jd@syntropy.co.uk:
A common way is to link the required library statically. That way your users do not have to worry about dependencies, installing DLLs with the right versions etc. To do that, add the mylibrary.a file to the linker command line.
That's what I'd like to do but I don't have a makefile for my plugin, or at least, I haven't created one. It just seems to get made automatically. What would be in such a makefile, and where would I put it? The default makefile (assuming that's what's being used) is mostly doing what I want except for the specification of the extra library.
Sorry to be such a dunce!
Just add a 'makefile' file to the directory where platform files of plugin are located (platforms/win32/plugins/YourPluginName/makefile)
here an example of makefile, for freetype plugin: --------------- include ../../Makefile.plugin
# This seems broken, but in the generated FT2Plugin.c there is an # include<tttables.h> which should be include<freetype/tttables.h> # so we simply add it to the include path. Eeek. INCLUDES+= -I$(WIN32DIR)/freetype
# Add the freetype libs to the build EXTRALIBS=$(WIN32DIR)/freetype.a -----------------
Thanks again,
--John
and to generate import library, please read this page: http://oldwiki.mingw.org/index.php/CreateImportLibraries
This page talks about creating a .def file but doesn't say where the file goes. Thanks again,
--John
2009/4/27 John Daniels jd@syntropy.co.uk:
and to generate import library, please read this page: http://oldwiki.mingw.org/index.php/CreateImportLibraries
This page talks about creating a .def file but doesn't say where the file goes. Thanks again,
It does,
[[ Once you've created the def-File (see above) you'll issue
dlltool -d somedll.def -l libsomedll.a
That's it. The resulting file libsomedll.a should satisfy the linker. ]]
it creating an import library (libsomedll.a) which you can link with your plugin (using -l linker option) so , that final .exe file will look for a .dll
--John
squeak-dev@lists.squeakfoundation.org