libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About win32 impgen.c patch


From: Naofumi Yasufuku
Subject: Re: About win32 impgen.c patch
Date: Wed, 23 Oct 2002 11:49:58 +0900
User-agent: Wanderlust/2.8.1 (Something) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (Unebigoryƍmae) APEL/10.3 Emacs/21.2 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Tue, 22 Oct 2002 20:39:56 -0500,
Robert Boehne wrote:
> 
> Naofumi,
> 
> Your patch has not been approved, but it hasn't been
> rejected either.  If you could briefly explain what
> the problem is and how your patch fixes it, I'd be
> glad to approve it.  I'm reluctant to commit patches
> that I don't understand, and I'm not familiar with the
> reason you'd need to quote the string if it has the .
> character in it.
> 

This impgen.c patch is based on the source code of dlltool in binutils.
This is the code from binutils-2.13/binutils/dlltool.c.

static void
gen_def_file ()
{
  int i;
  export_type *exp;

  inform (_("Adding exports to output file"));

  fprintf (output_def, ";");
  for (i = 0; oav[i]; i++)
    fprintf (output_def, " %s", oav[i]);

  fprintf (output_def, "\nEXPORTS\n");

  for (i = 0, exp = d_exports; exp; i++, exp = exp->next)
    {
      char *quote = strchr (exp->name, '.') ? "\"" : "";
      char *res = cplus_demangle (exp->internal_name, DMGL_ANSI | DMGL_PARAMS);

      if (strcmp (exp->name, exp->internal_name) == 0)
        {

          fprintf (output_def, "\t%s%s%s @ %d%s%s ; %s\n",
                   quote,
                   exp->name,
                   quote,
                   exp->ordinal,
                   exp->noname ? " NONAME" : "",
                   exp->data ? " DATA" : "",
                   res ? res : "");
        }
      else
        {
          char *quote1 = strchr (exp->internal_name, '.') ? "\"" : "";
          /* char *alias =  */
          fprintf (output_def, "\t%s%s%s = %s%s%s @ %d%s%s ; %s\n",
                   quote,
                   exp->name,
                   quote,
                   quote1,
                   exp->internal_name,
                   quote1,
                   exp->ordinal,
                   exp->noname ? " NONAME" : "",
                   exp->data ? " DATA" : "",
                   res ? res : "");
        }
      if (res)
        free (res);
    }

  inform (_("Added exports to output file"));
}

'.' is a special character in the export table, and it is used to
declare a symbol name as an alias (forward) of the function
in other external DLL.

Following comment is described in dlltool.c.

   EXPORTS  ( (  ( <name1> [ = <name2> ] )
               | ( <name1> = <module-name> . <external-name>))
            [ @ <integer> ] [ NONAME ] [CONSTANT] [DATA] ) *
   Declares name1 as an exported symbol from the
   DLL, with optional ordinal number <integer>.
   Or declares name1 as an alias (forward) of the function <external-name>
   in the DLL <module-name>.

If an internal symbol includes '.', the symbol name must be quoted.

Some g++ symbols includes '.' character (for example, anonymous
namespace symbols), and they need to be quoted.

Regards,
--Naofumi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]