This is the mail archive of the cygwin 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]
Other format: [Raw text]

Re: [cfe-dev] cygwin updates (was: dladdr and Dl_info)


On Jan 15 11:40, Vincent R. wrote:
> It's not too difficult to add Dl_info definition (We will support only
> retrieving path name):
> 
> typedef struct 
> {
>   const char 	*dli_fname[PATH_MAX];	/* Filename of defining object */
>   void 		*dli_fbase;      	/* NA */
>   const char 	*dli_sname;		/* NA */
>   void 		*dli_saddr;      	/* NA */
> } Dl_info;
> 
> 
> int dladdr(void *addr, Dl_info *info)
> {
>    // see
> http://trac.enlightenment.org/e/browser/trunk/PROTO/evil/src/lib/dlfcn/dlfcn.c
>    // for an implementation   
> }

The implementation won't work on Cygwin for functions exported by the
Cygwin DLL itself.  At least not as you expect it to work.  Every such
symbol will return the application's pathname in dli_fname.  The reason
is the way the functions are exported from libcygwin.a.  You always get
the address of the function stub linked statically to the executable.
I fear this needs more work for Cygwin.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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