mirror of
https://github.com/reactos/reactos.git
synced 2024-09-09 04:10:19 +00:00
[SPEC2DEF]
Add support for adding aliases when exporting data by specifying the -withalias switch. This will cause MS LINK to generate _FooVar as an alias alias for _imp__FooVar. While this looks wrong and is not the way you usually handle data imports, this is what we have in the DDK for a number of data exports like KdDebuggerNotPresent, IoFileObjectType, ..., which we currently define in an incompatible way. Remove stdcall decorations on non-x86 builds svn path=/trunk/; revision=63217
This commit is contained in:
parent
6c9afdb590
commit
fda4b225f8
|
@ -52,6 +52,7 @@ enum
|
||||||
FL_STUB = 2,
|
FL_STUB = 2,
|
||||||
FL_NONAME = 4,
|
FL_NONAME = 4,
|
||||||
FL_ORDINAL = 8,
|
FL_ORDINAL = 8,
|
||||||
|
FL_DATA_ALIAS = 16
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -369,6 +370,15 @@ PrintName(FILE *fileDest, EXPORT *pexp, PSTRING pstr, int fDeco)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Does the string already have stdcall decoration? */
|
||||||
|
pcAt = ScanToken(pcName, '@');
|
||||||
|
if (pcAt && (pcAt < (pcName + nNameLength)) && pcName[0] == '_')
|
||||||
|
{
|
||||||
|
/* Skip leading underscore and remove trailing decoration */
|
||||||
|
pcName++;
|
||||||
|
nNameLength = pcAt - pcName;
|
||||||
|
}
|
||||||
|
|
||||||
/* Print the undecorated function name */
|
/* Print the undecorated function name */
|
||||||
fprintf(fileDest, "%.*s", nNameLength, pcName);
|
fprintf(fileDest, "%.*s", nNameLength, pcName);
|
||||||
}
|
}
|
||||||
|
@ -492,7 +502,9 @@ OutputLine_def(FILE *fileDest, EXPORT *pexp)
|
||||||
fprintf(fileDest, " PRIVATE");
|
fprintf(fileDest, " PRIVATE");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pexp->nCallingConvention == CC_EXTERN)
|
/* Make this a data export, unless this is MSVC and -withalias was given */
|
||||||
|
if ((pexp->nCallingConvention == CC_EXTERN) &&
|
||||||
|
!(gbMSComp && (pexp->uFlags & FL_DATA_ALIAS)))
|
||||||
{
|
{
|
||||||
fprintf(fileDest, " DATA");
|
fprintf(fileDest, " DATA");
|
||||||
}
|
}
|
||||||
|
@ -645,6 +657,15 @@ ParseFile(char* pcStart, FILE *fileDest, PFNOUTLINE OutputLine)
|
||||||
{
|
{
|
||||||
exp.uFlags |= FL_STUB;
|
exp.uFlags |= FL_STUB;
|
||||||
}
|
}
|
||||||
|
else if (CompareToken(pc, "-withalias"))
|
||||||
|
{
|
||||||
|
/* This flag is to create a nin _imp_ prefixed alias for a
|
||||||
|
data export, so that the hacked DDK declarations work */
|
||||||
|
if (exp.nCallingConvention != CC_EXTERN)
|
||||||
|
fprintf(stderr, "error: line %d -withalias on non-data export\n", nLine);
|
||||||
|
else
|
||||||
|
exp.uFlags |= FL_DATA_ALIAS;
|
||||||
|
}
|
||||||
else if (CompareToken(pc, "-norelay") ||
|
else if (CompareToken(pc, "-norelay") ||
|
||||||
CompareToken(pc, "-register") ||
|
CompareToken(pc, "-register") ||
|
||||||
CompareToken(pc, "-ret64"))
|
CompareToken(pc, "-ret64"))
|
||||||
|
|
Loading…
Reference in a new issue