[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
libtool dll creation (mingw32 undefined symbols)
From: |
richard |
Subject: |
libtool dll creation (mingw32 undefined symbols) |
Date: |
Tue, 17 Apr 2007 23:18:24 +0200 |
User-agent: |
Icedove 1.5.0.10 (X11/20070329) |
Hello list,
for a project i'd like to create a plugin mechanism, and don't want to
be the bottleneck when the project is slowly made ready for cross
compilation to win32.
I'd like to start slow by just crosscompile a executable and a dynamic
library,
but i fail at building the .dll with libtool complaining about
libtool: link: warning: undefined symbols not allowed in
i586-pc-mingw32msvc shared libraries
using:
automake 1.10
autoconf 2.1.6
libtool 1.5.22
gcc 4.1.2
mingw32 3.4.5
in debian unstable
The --no-undefined is set for the library, and i tried to follow the
(maybe seriously outdated dll compilation howto from the autobook at
http://sourceware.org/autobook/autobook/autobook_252.html#SEC252)
I also tried to __declspec(dllexport) but thought that this is for data
export only -
so i think i got something wrong or don't fully understand what i am doing-
i would be very thankful for an simple howto or demo program which
accomplishes what i am trying to do.
I took a look at the libltdl sources, because they compile perfectly as
a dll, but did not manage to get much out of it.
So i am a little stuck at the moment.
here is more info how i try to get it done:
i configure it with
./configure --target=i586-mingw32msvc --host=i586-mingw32msvc
--build=i686-pc-linux-gnu --disable-static
there is a configure.ac and a Makefile am in my top-dir
and plugin.cpp plugin.h test.cpp and test.h in the src dir
their contents are:
Makfile.am:
SUBDIRS = src
configure.ac:
AC_PREREQ(2.50)
AC_INIT([amplug],[1.0],address@hidden)
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_C_CONST
AC_C_INLINE
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_SUBST([LIBTOOL_DEPS])
AC_LIB_LTDL
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT
src/Makefile.am
lib_LTLIBRARIES = libtest.la
libtest_la_SOURCES = test.cpp test.h
libtest_la_LDFLAGS = --no-undefined -version-info 0:0:0 -Wall -Werror
--debug
libtest_la_CXXFLAGS = -Wall -Werror
libtest_la_LIBADD = $(LIBADD_DL)
bin_PROGRAMS = plug
plug_SOURCES = plugin.cpp plugin.h
plug_LDADD = libtest.la
src/test.h
#ifndef TEST_H_
#define TEST_H_
#if HAVE_CONFIG_H
# include <config.h>
#endif
extern "C"{
extern int computesomething(void);
}
#endif /*TEST_H_*/
src/test.cpp
#include"test.h"
int computesomething(void){
return 42;
}
src/plugin.cpp
#include"test.h"
int main(int argc, char** args){
std::cout << "testing dll crosscompile" << std::endl;
std::cout << computesomething() << std::endl;
return 0;
}
thanks in advance,
Richard
- libtool dll creation (mingw32 undefined symbols),
richard <=