libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to create shared library(dll) without lib prefix ?


From: Roumen Petrov
Subject: How to create shared library(dll) without lib prefix ?
Date: Mon, 16 Jul 2007 22:34:33 +0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.10) Gecko/20070306 SeaMonkey/1.0.8

Let a project use libtool to make libraries.

In case of mingw build (cross-compilation) in many cases is good dll to be 
without lib prefix.
In these cases cross-compilation can create dlls with same names as native 
build and those dlls can be used instead native build.
The name of import library can left libNAME.dll.a.

When building shared libraries on unix usually Makefile.am contain lib_LTLIBRARIES = 
lib<NAME>.la and result is lib<NAME>.so...
It is similar to case for pcre.la (topic "dll names on windows") but with 
lib-prefix for la-file.


How to do this?


Notes:

- libtool macro AC_LIBTOOL_SYS_DYNAMIC_LINKER don't preserve "libname_spec" set by CONFIG_SITE so 
that I cannot use "libname_spec="\$name"" in CONFIG_SITE file;

- same for "soname_spec";

- LDFLAGS -module is only to inform automake that we use "nonstandard" name, 
i.e without lib prefix.
This is not my case since for other systems lib prefix is fine.
Also note that with argument "-module" file is installed in libdir (!) and 
without in bindir;

- to use def-file with content "LIBRARY NAME.dll" and to pass to linker by 
example with -export-symbols.
In this case import library "libNAME.dll.a" is created for "NAME.dll" but dll-name is 
"libNAME.dll".
We can rename dll (to remove lib prefix) and in file "libNAME.la" to remove 
lib-prefix in dlname.
In this case libtool will install "NAME.dll", i.e. without lib prefix, but 
create in libdir la-file with dlname='../bin/libNAME.dll' so that we should edit again.


More info:
Command:
$i386-mingw32msvc-gcc -shared  ... -o .libs/<NAME>.dll ... -Xlinker --out-implib -Xlinker 
.libs/lib<NAME>.dll.a"
create dll without lib prefix and put <NAME>.dll in import library.


Roumen





reply via email to

[Prev in Thread] Current Thread [Next in Thread]