Re: On the cost of libraries
- From: Murray Cumming <Murray_Cumming BetaResearch de>
- Cc: GNOME Hackers <gnome-hackers gnome org>
- Subject: Re: On the cost of libraries
- Date: Mon, 03 Sep 2001 13:17:48 +0200
Rodrigo Moya wrote:
>
> On Mon, 2001-09-03 at 10:43, Daniel Veillard wrote:
> >
> > First I completely agree with the need to have an explicit
> > declaration of symbols made extern.
> >
> > On Sun, Sep 02, 2001 at 09:22:20PM -0400, Owen Taylor wrote:
> > > The normal approach on windows is something on the order of:
> > >
> > > G_EXTERN void my_function_to_export ();
> > >
> > > Rather ugly, but certainly explicit.
> > >
> > > (For the GTK+ libraries, we actually have separately maintained .defs
> > > files to keep track of exports for the Windows port - which is in no
> > > way good, and we need to get away from one way or the other.)
> >
> > Same for libxml/xslt they manually keep a ref file and I break
> > it each time I add an new API entry point :-\
> > Also we had quite a bit of discussion about this and on Windows
> > it seems just having a single EXTERN declaration wasn't completely
> > sufficient (don't ask me why :-)
> >
> > All in all we need a solution to this problem, and we should have
> > it implemented in Gnome2. I'm waiting for a candidate solution to propose
> > to my Windows maintainer :-)
> >
> on windows, as far as I remember, you need to use a .def file where you
> list all exported symbols. Symbols that are not listed in that file are
> not exported at all.
If I remember correctly:
You have the alternative of using these Visual C++ language extensions:
_declspec(dllexport)
_declspec(dllimport)
In practice, library authors tend to define a macro (e.g.
LIBSOMETHING_EXPORT) which expands to _declspec(dllexport) when used to
compile the library, and _declspec(dllimport) when used externally via
the headers.
This is old, but might be informative:
http://www.murrayc.com/learning/windows/dll.shtml#Creating
Shared libraries on Windows are a nightmare, particularly with C++. For
me, it's probably the best thing about switching to Unix/Linux
development.
--
Murray Cumming
www.murrayc.com
murrayc usa net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]