This is the mail archive of the cygwin@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: Re[6]: Importing a variable from a DLL


Paul Sokolovsky <paul-ml@is.lg.ua> writes:
> 
>     I also made mine, it requires changing only dlltool.c: (against
> b20 distribution)
> 
> *** dlltool.c.org       Tue Oct 27 03:04:10 1998
> --- dlltool.c   Thu Aug 26 22:31:32 1999
> ***************
> *** 1144,1149 ****
> --- 1144,1150 ----
>       {
>         asymbol *sym;
>         const char *symbol_name;
> +       int data;
> 
>         sym = bfd_minisymbol_to_symbol (abfd, false, from, store);
>         if (sym == NULL)
> ***************
> *** 1153,1166 ****
>         if (bfd_get_symbol_leading_char (abfd) == symbol_name[0])
>         ++symbol_name;
> 
> !       def_exports (xstrdup (symbol_name) , 0, -1, 0, 0, 0);
> 
>         if (add_stdcall_alias && strchr (symbol_name, '@'))
>           {
>           char *exported_name = xstrdup (symbol_name);
>           char *atsym = strchr (exported_name, '@');
>           *atsym = '\0';
> !         def_exports (exported_name, xstrdup (symbol_name), -1, 0, 0, 0);
>         }
>       }
>   }
> --- 1154,1171 ----
>         if (bfd_get_symbol_leading_char (abfd) == symbol_name[0])
>         ++symbol_name;
> 
> ! /* Don't use bfd_decode_symclass() - remember, symbols with constant
> !    values dumped to code section */
> !       data = !(sym->flags&BSF_FUNCTION);
> !
> !       def_exports (xstrdup (symbol_name) , 0, -1, 0, 0, data);
> 
>         if (add_stdcall_alias && strchr (symbol_name, '@'))
>           {
>           char *exported_name = xstrdup (symbol_name);
>           char *atsym = strchr (exported_name, '@');
>           *atsym = '\0';
> !         def_exports (exported_name, xstrdup (symbol_name), -1, 0, 0, data);
>         }
>       }
>   }
> 

Thanks.

This is only a partial solution for --export-all case. The other one is
handled by looking at .drectve section for symbols exported explicitly
via dllexport attribute. See scan_drectve_symbols in dlltool.c. A small
GCC change is necessary to support that one. 

btw, please use the -p option when creating diffs; it helps to see the
function name in the patch.

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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