dbTalk Databases Forums  

Building Shared library with mingw

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Building Shared library with mingw in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Carlos Flores
 
Posts: n/a

Default Building Shared library with mingw - 03-25-2006 , 05:21 PM






------=_Part_5508_22261916.1143328791686
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I actually found a way to build a shared library, all you have to do is go
through all thwe process to build a static one, then use one of the usefull
minngw tools, a2dll, all you have to do is:

a2dll libmysqlpp.a libmysqlpp.dll --driver-name=3Dg++

And it will do the magic around, there are only two things, the examples
must be built deleting the define that tells that ther is no dll, and thank=
s
to the gracefull behavior of ld, you *must* link against the dll, forget th=
e
import library.

I have done it with g++ 3.4.4 and latest update of binutils avaible on
mingw.org windows I will try it building cross over platform from my ubuntu
system

------=_Part_5508_22261916.1143328791686--

Reply With Quote
  #2  
Old   
Warren Young
 
Posts: n/a

Default Re: Building Shared library with mingw - 03-31-2006 , 10:55 AM






Carlos Flores wrote:
Quote:
I actually found a way to build a shared library, all you have to do is go
through all thwe process to build a static one,
Sigh...I can't even the examples to link to the library statically any
more. I've uploaded a version of MySQL++ 2.1.0 with just a few small
changes that build the library statically. Can you please download this
and try it? It is:

http://tangentsoft.net/mysql++/test/...2.1.0ms.tar.gz

('ms' stands for MinGW static. This will not work on other platforms.)

Quote:
then use one of the usefull minngw tools, a2dll
I have three problems with this. First, a2dll is a Bourne shell script.
That means we would have to require either MSYS or Cygwin to be
installed as well as MinGW. Second, it isn't part of the base MinGW
distribution; that's another dependency. Third, it's basically just a
wrapper around dllwrap, which is a deprecated tool. I did some
searching about it on the MinGW mailing list, and the sense I get is
that ld -shared is supposed to do everything that dllwrap ever did, so
there is no interest in helping with any problems we may have.

I don't see why those of you interested in getting MySQL++ to work as a
DLL under MinGW don't just take it up on the MinGW mailing list. Show
them the errors you're getting, point them to the source code, and have
them work it out.



--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
Carlos Flores
 
Posts: n/a

Default Re: Building Shared library with mingw - 04-03-2006 , 04:12 PM



------=_Part_13918_20284476.1144098749680
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Warren Young wrote:
Quote:
Sigh...I can't even the examples to link to the library statically any
more. I've uploaded a version of MySQL++ 2.1.0 with just a few small
changes that build the library statically.
Aparently it has something to do with bakefile, I actually looked into the
makefiles it generated for mingw, they appear to be the same as the msvc
ones, wich support dll without any patch, so it must build a wrong static
library, (not 'blessed by 'ran' and with those _decspec(dllexport) included=
,
which is evil

I found a workaround, but it is not so native, i mean you need an ide, but
the good thing is that it inmediatly builds a dll, it is using code::blocks
to import msvc project (can be done from linux (cross-platform), but i will
investigate some more to do it without the ide, maybe make it generate the
makefiles.

Quote:
I did some searching about it on the MinGW mailing list, and the sense I
get is that ld -shared is supposed to do everything that dllwrap ever did,
so there is no interest in helping with any problems we may have.

Besides all of it, it appears that in fact all the difference between mingw
ld is some work with --auto-import and --enable-runtime-pseudo-relloc flags=
,
because i have hand compiled the library, and is everything that i have eve=
r
needed.

------=_Part_13918_20284476.1144098749680--


Reply With Quote
  #4  
Old   
Carlos Flores
 
Posts: n/a

Default Re: Building Shared library with mingw - 04-18-2006 , 01:41 PM



------=_Part_25294_23188491.1145385680837
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Warren Young wrote
Quote:
Evil has nothing to do with it. They are _necessary_ for Visual C++,
and I thought they were necessary for MinGW since GCC supports the syntax=
..

Quote:
But this comment of yours made me wonder, what happens if you try to
build a DLL with the declspecs turned off? Guess what: it works! I
don't know why MinGW's GCC bothers to support this syntax if it doesn't
do the right thing with it.
In fact there is a little history behind the _decspec(dllexport/dllimport),
they seemed to have a lot of usage for address translation in the days of
DOS and win16, which where almost the same thing. Their work was to provide
(at compile time) the addresses that the system will give inside the memory
of the program in order to emulate static library behavior, but it does not
happens any more on win32 (and surely win64) so I think the keywords were
left for compatibility and/or new behavior of address translation.

MinGW supports it because it needs to use the native built libraries of the
system, and they are all marked with those keywords, so they added ld som e
new interfaces, auto-import, auto-export and runtime-pseudo-relloc, which
are workaround for importing UNIXish libraries to windows.

------=_Part_25294_23188491.1145385680837--


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.