[ros-diffs] [tkreuzer] 52765: [SPEC2DEF] Fix creation of stubs for c++ mangled names

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Thu Jul 21 18:39:25 UTC 2011


Author: tkreuzer
Date: Thu Jul 21 18:39:24 2011
New Revision: 52765

URL: http://svn.reactos.org/svn/reactos?rev=52765&view=rev
Log:
[SPEC2DEF]
Fix creation of stubs for c++ mangled names

Modified:
    trunk/reactos/tools/spec2def/spec2def.c

Modified: trunk/reactos/tools/spec2def/spec2def.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/spec2def/spec2def.c?rev=52765&r1=52764&r2=52765&view=diff
==============================================================================
--- trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] (original)
+++ trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] Thu Jul 21 18:39:24 2011
@@ -19,6 +19,7 @@
     int nArgCount;
     int anArgs[30];
     unsigned int uFlags;
+    int nNumber;
 } EXPORT;
 
 enum _ARCH
@@ -168,7 +169,15 @@
         fprintf(file, "__stdcall ");
     }
 
-    fprintf(file, "%.*s(", pexp->nNameLength, pexp->pcName);
+    /* Check for C++ */
+    if (pexp->pcName[0] == '?')
+    {
+        fprintf(file, "stub_function%d(", pexp->nNumber);
+    }
+    else
+    {
+        fprintf(file, "%.*s(", pexp->nNameLength, pexp->pcName);
+    }
 
     for (i = 0; i < pexp->nArgCount; i++)
     {
@@ -334,6 +343,13 @@
         fprintf(fileDest, "=");
         PrintName(fileDest, pexp, "", 1, fDeco && !gbMSComp);
     }
+    else if (((pexp->uFlags & FL_STUB) || (pexp->nCallingConvention == CC_STUB)) &&
+             (pexp->pcName[0] == '?'))
+    {
+        /* C++ stubs are forwarded to C stubs */
+        fprintf(fileDest, "=");
+        fprintf(fileDest, "stub_function%d(", pexp->nNumber);
+    }
     else if ((giArch == ARCH_X86) && gbKillAt && !gbMSComp &&
              (pexp->nCallingConvention == CC_STDCALL ||
               pexp->nCallingConvention == CC_FASTCALL))
@@ -379,12 +395,14 @@
 
     /* Loop all lines */
     nLine = 1;
+    exp.nNumber = 0;
     for (pcLine = pcStart; *pcLine; pcLine = NextLine(pcLine), nLine++)
     {
         pc = pcLine;
 
         exp.nArgCount = 0;
         exp.uFlags = 0;
+        exp.nNumber++;
 
         //fprintf(stderr, "info: line %d, token:'%d, %.20s'\n",
         //        nLine, TokenLength(pcLine), pcLine);
@@ -591,7 +609,7 @@
             /* Check for c++ mangled name */
             if (pc[0] == '?')
             {
-                printf("Found c++ mangled name...\n");
+                //printf("Found c++ mangled name...\n");
                 //
             }
             else




More information about the Ros-diffs mailing list