[squeak-dev] Linking a plugin with a library

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Linking a plugin with a library

John Daniels-3
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


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Linking a plugin with a library

Igor Stasenko
2009/4/27 John Daniels <[hidden email]>:
> 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
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Linking a plugin with a library

Bert Freudenberg

On 27.04.2009, at 12:23, Igor Stasenko wrote:

> 2009/4/27 John Daniels <[hidden email]>:
>> 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 -



Reply | Threaded
Open this post in threaded view
|

Re[2]: [squeak-dev] Linking a plugin with a library

John Daniels-3
In reply to this post by Igor Stasenko
> 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


Reply | Threaded
Open this post in threaded view
|

Re[2]: [squeak-dev] Linking a plugin with a library

John Daniels-3
In reply to this post by Bert Freudenberg
> 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


Reply | Threaded
Open this post in threaded view
|

Re: Re[2]: [squeak-dev] Linking a plugin with a library

Igor Stasenko
In reply to this post by John Daniels-3
2009/4/27 John Daniels <[hidden email]>:
>> 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
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: Re[2]: [squeak-dev] Linking a plugin with a library

Igor Stasenko
In reply to this post by John Daniels-3
2009/4/27 John Daniels <[hidden email]>:

>> 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
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re[4]: [squeak-dev] Linking a plugin with a library

John Daniels-3
Thanks Igor, that was exactly the information I needed.

--John

====
Original message
From: Igor Stasenko <[hidden email]>
Date: 27 April 2009
Time: 12:39:42 PM
Subject: [squeak-dev] Linking a plugin with a library
----
2009/4/27 John Daniels <[hidden email]>:

>> 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
>
>
>



--
Best regards,
Igor Stasenko AKA sig.