This is the mail archive of the cygwin-xfree@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: dll initialization




>
> I've been looking at the source for Xaw but I haven't been able to figure
> out why it can't be built as a DLL.  From the FAQ it seems like
> the problem
> is in the way these libs are used.  Since I'm new to X programing
> I thought
> someone here would know what the problem is or could provide a simple
> example of what doesn't work.  In the mean time I'll look at the sources
> for the programs that were included to see if I can find the
> problem.  That
> answer in the FAQ doesn't seem clear to me.

The problem is with the way WIn32 DLL initialize.  This is Win32
limitations.

This is the answer and again it is from FAQ.  Xt, Xaw and Xmu cannot be
built as
DLLs because

"it is not possible to export data from a Win32 DLL in a
form that can be used to statically initialize another global variable.
Data access from a DLL requires at least one pointer"

You can do it two ways.  Either write a custom DLL, like Hummingbird folks
did
for Exceed.  The other place I have seen is UWIN.  They built all of the
libs as DLLs
and I know from experience when MOTIF applications were linked to Xaw and Xt
DLLs
from UWIN, they coredumped because of DLLs initialization problems.

Suhaib

>
> At 04:51 AM 5/11/00, you wrote:
>
>
> > >
> > > After struggling with trying to make a dynamic version
> > > of the higher level X libraries, such as Xt.  It seems
> > > that I need to know something about dll initialization
> > > in the context of what is going on with X.
> >
> >
> >
> >You SIMPLY cannot DO THIS. Period.  Unless you got plenty of
> >time on your hand to invent something new and reinvent
> >the wheels.
> >
> >Did you read FAQ?  Here is a cut and paste for you.
> >
> >3.12 Will there be Xaw.DLL, Xt.DLL and Xmu.DLL?
> >
> >
> >  No. GCC is free software, and most stuff written for it is
> >also freely available. Recompile if you want.However, keep the
> following in
> >mind:
> >
> >"One of the biggest issues with X on Win32 is the moronic DLL format.
> >Specifically - it is not possible to export data from a Win32 DLL in a
> >form that can be used to statically initialize another global variable.
> >Data access from a DLL requires at least one pointer
> >
> >
> >indirection, and hence executable code. This is why X11R6 doesn't
> >have DLLs for Xt/Xmu/Xaw (and Motif) on Win32", quoted from
> >XFree86-developers Mailing List - David E. Wexelblat
> >(dwex@datafocus.com) Wed, 25 Mar 1998 10:08:27 -0500.
> >
> >
> >Suhaib
> >
> >
> >
> > >
> > > Basic DLL's that I built have have been able to make
> > > use of global data with the decoration of __declspec's
> > > as appropriate.  But that does not seem to be enough
> > > for the higher level X stuff.  There appears to be a
> > > need for additional, manual, initialization.  (Is this
> > > a multithread issue?)
> > >
> > > Could someone point me somewhere so that I could learn
> > > what is going on.  I suppose that some discussion
> > > would be useful concerning how the higher level X
> > > libraries are 'different' from the (perhaps simple)
> > > DLL's that I've been coding myself.
> > >
> > > I'll certainly believe the maxim that global data is
> > > evil!  But it is not just global data, this is a
> > > global pointer issue I'm sure.  Perhaps something as
> > > simple as an allocation in an initialization step is
> > > all that is required.  At any rate I'm convinced that
> > > there is a general purpose programming lesson for me
> > > here.
> > >
> > > Thanks for the help.
> > >
> > > =====
> > > -- Craig Stevenson
> > > -- Home Page: http://www.sdc.org/~craigs/
> > > -- Recently computed: The 200 billionth digit of pi is 2.
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Send instant messages & get email alerts with Yahoo! Messenger.
> > > http://im.yahoo.com/
>
> ---
> Kenneth Haley <mailto:khaley@bigfoot.com>
> Yahoo! Messenger -- http://profiles.yahoo.com/haleykd
> Website  http://www.bigfoot.com/~khaley
> PGP --
> http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=khaley@bigfoot.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]