List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:July 28 2005 11:52pm
Subject:MinGW DLL build saga continues...
View as plain text  
Thanks to some help from list member Robin, I've got a MinGW building 
MySQL++ as a DLL.  Unfortunately, there's a new problem, which is that 
MinGW can't link programs to it.

VC++ builds DLLs just fine, so there's a limit to how much more effort 
I'm willing to put into this.  So, I hope some of you MinGW users out 
there will try this, and see if you can figure out what MinGW is 
complaining about.

To see the problem, check out a copy of the current repository version 
of MySQL++, and type "makemake mingw" in the project directory to build 
the DLL.  The examples will fail to build, but nevermind that for now. 
Try to build this simple program instead:

#include <mysql++.h>

int main()
{
         mysqlpp::Connection c;
         mysqlpp::Date d;
         return 0;
}

The command line for that is:

g++ -Ic:\mysql\include -Ilib foo.cpp -o foo.exe \
	-Lc:\mysql\lib\mingw -lmysql -Llib -lmysqlpp

...assuming that you call it foo.cpp and put it in the base project 
directory.

You'll get these errors:

c:\tmp/ccuqhaaa.o(.text$_ZN7mysqlpp4DateD1Ev[mysqlpp::Date::~Date()]+0xb):foo.cp
p: undefined reference to `vtable for mysqlpp::Date'
c:\tmp/ccuqhaaa.o(.text$_ZN7mysqlpp4DateC1Ev[mysqlpp::Date::Date()]+0x16):foo.cp
p: undefined reference to `vtable for mysqlpp::Date'
collect2: ld returned 1 exit status

According to what I've found searching online, this means the linker 
believes the subclass isn't defining all of the virtual functions 
declared in its parent class(es).  That's B.S., of course, because this 
code works with many other platforms.  Perhaps a clue lies in the 
mangled names above: anyone have a tool to demangle arbitrary g++ 
symbols?  (like nm -C does)

Notice that it doesn't complain about Connection, only Date.  I've tried 
several other classes here.  The Exception subclasses compile and link, 
for instance.  But Fields and Row do not.  What do these problem classes 
have in common with each other, but not with the working classes?
Thread
MinGW DLL build saga continues...Warren Young29 Jul
  • Re: MinGW DLL build saga continues...Warren Young3 Aug
Re: MinGW DLL build saga continues...Warren Young29 Jul