Mail Archives: cygwin/2001/08/19/23:22:41
>
> This is really a "how to build dll's" question and belongs on the cygwin
> list, not private mail. For your convenience, I've copied this message
> to the list and set the Reply-To; appropriately.
Sorry , I didn't send it to cygwin list as I wrongly assumed that it
wasnt a cygwin specific question , just a gcc+windows question and as
your site has this type of thing...
anyway , thanks
>
> Jason Moxham wrote:
>
> > Using the latest cygwin I can compile and run the "c" version of
> > dllhelpers-0.2.7 , but what I'm having trouble with is , if my dll
> > contains referances to varibles/fns in the main exe or another dll
> > then I get undefined referances when I try to compile my dll
>
>
> Right. you can't do that on windows. DLLs (unlike unix shared
> libraries) are not allowed to have any unresolved symbols. Thus, you
> can't have forward references from the DLL to a client executable.
ARGHHHHH!!!!
I should of checked before I started programming , windows has so many
arbitary limitations , I dread the day when I have to change to a
multi-threaded version of my program
> There are two ways to proceed:
>
> 1) put the "common" data items in a second DLL that can be built
> independently of the first DLL and the executable. Then, when building
> the original DLL, link against this second one. When building the
> executable, link against both DLLs.
>
> or
>
> 2) Create hook functions in your DLL to set a DLL-internal pointer to
> point to your exe's variable. Within the DLL, only use the pointer in
> your operations.
>
Thanks , I can use either of these methods , although the first seems
easier
Jason Moxham
j DOT l DOT moxham AT maths DOT soton DOT ac DOT uk
> e.g.
>
> DLL:
> int * ext_data;
> void set_ext_data(int * c) {ext_data = c};
> In dll, use *ext_data.
>
> client exe:
> int data;
> set_ext_data(&data);
> in client, use data.
>
> --Chuck
>
>
> >
> > for example
> >
> > add to usedll.c (not in main fn)
> >
> > int jayglob;
> >
> >
> >
> > add to cdll.c
> >
> > int jay(void){return jayglob;}
> >
> >
> > add to cdll.h
> >
> > int jay(void);
> > extern int jayglob;
> >
> >
> > then when I try to compile cygcdll.dll I get undefined referances to
> > jayglob
> >
> >
> >
> > Of course under linux , no problems
>
>
>
> --
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting: http://cygwin.com/bugs.html
> Documentation: http://cygwin.com/docs.html
> FAQ: http://cygwin.com/faq/
>
>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -