This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PE-COFF and import tables
On Sunday 10 May 2009 12:42:01, Vincent R. wrote:
> I tried to understand why only _fileno and _strdup are put in a separate
> entry and the only common
> point is the fact these two symbols are actually defines and also that they
> are defined in libcoredll.a
> and in libceoldname.a
>
> in libcoredll.a they are defined as : _strdup and _fileno (prefixed by a _)
> in libceoldname.a they are defined as : strdup and fileno
The underscored versions are what really exists in coredll.dll. lib*oldname.a
is a compatibility import lib that through .def file magic allows references
to a few non-underscored functions to still link and resolve to the underscored
versions, otherwise, this wouldn't link:
int main ()
{
strdup (0);
}
, because there's no real strdup function in MSFT's runtimes.
The proper way to write that for Windows would be:
int main ()
{
_strdup (0);
}
, but, this is a portability nuisance, hence, the magic *oldname.a
import lib.
You have references to both `strdup' and `fileno' somewhere
in your code.
--
Pedro Alves