create .lib and .dll in one build

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

create .lib and .dll in one build

Petry Stefan
Hello everyone!

I´ve a small question: Is it possible to create a .lib-file (which includes definitions of functions) and a .dll (which includes declarations of functions) in one build? Like it´s possible in Visual Studio 2005.

If yes, how do I have to set the linker options?

I´m using Eclipse CDT and MinGW5.4.1.

Thanks and best regards,

Steve

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: create .lib and .dll in one build

Tor Lillqvist
> I´ve a small question: Is it possible to create a .lib-file (which includes definitions of functions) and a .dll (which includes declarations of functions) in one build? Like it´s possible in Visual Studio 2005.

First I would like to clear up some terminological confusion. The
normal term used to describe a .lib file that corresponds to a .dll
file is "import library". The term pair "definition" vs. "declaration"
is usually used for source code in a language like C, where

int foo(int a, const char *b);

is a declaration, and

int foo(int a, const char *b)
{
  /* do something... */
  return 42;
}

is the definition.

Then there is the question that the extension .lib is used for import
libraries by Microsoft's toolchain, as you say. The GNU toolchain
(MinGW) uses the extension .a, typically .dll.a even.

It at least used to be that the format of import libraries was
compatible with that used by MinGW, one could for instance simply copy
a import library generated by MinGW to a name ending with .lib and use
it with Microsoft's compiler. Please note that this is for pure C APIs
only. One cannot mix code produced by different compilers in the case
of C++ APIs.

> If yes, how do I have to set the linker options?

The options you are looking for is -out-implib.

--tml

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: create .lib and .dll in one build

Vincent Torri


On Mon, 20 Oct 2008, Tor Lillqvist wrote:

> Then there is the question that the extension .lib is used for import
> libraries by Microsoft's toolchain, as you say. The GNU toolchain
> (MinGW) uses the extension .a, typically .dll.a even.

Can you explain the difference between .a and .dll.a ? (or give a link
that explain that difference)

thank you

Vincent Torri

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: create .lib and .dll in one build

Brian Dessent
Vincent Torri wrote:

> Can you explain the difference between .a and .dll.a ? (or give a link
> that explain that difference)

Naming an import library with a .dll.a extension makes it clear to
humans that it's an import library and not a static library, but this is
only a cosmetic issue as there is no difference in the content of the
file.

Brian

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: create .lib and .dll in one build

John E. / TDM
Brian Dessent wrote:
> Naming an import library with a .dll.a extension makes it clear to
> humans that it's an import library and not a static library, but this is
> only a cosmetic issue as there is no difference in the content of the
> file.
>  

Technically, there is one other function of the naming difference to be
aware of, as far as binutils' LD (for the uninitiated, a tool invoked by
GCC) is concerned. When -Bdynamic is used (this is almost always the
default) and there are two libraries identically named except for the
extension, the .dll.a file will be chosen over the .a file; when
-Bstatic is used, the .a file will be chosen over the .dll.a file.

-John E.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users