Merge pull request #975 from jbrodman/windll
Change dll export feature to a switch.
This commit is contained in:
1
ispc.cpp
1
ispc.cpp
@@ -1316,6 +1316,7 @@ Globals::Globals() {
|
|||||||
FATAL("Current directory path too long!");
|
FATAL("Current directory path too long!");
|
||||||
#endif
|
#endif
|
||||||
forceAlignment = -1;
|
forceAlignment = -1;
|
||||||
|
dllExport = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
3
ispc.h
3
ispc.h
@@ -612,6 +612,9 @@ struct Globals {
|
|||||||
/** Indicates that alignment in memory allocation routines should be
|
/** Indicates that alignment in memory allocation routines should be
|
||||||
forced to have given value. -1 value means natural alignment for the platforms. */
|
forced to have given value. -1 value means natural alignment for the platforms. */
|
||||||
int forceAlignment;
|
int forceAlignment;
|
||||||
|
|
||||||
|
/** When true, flag non-static functions with dllexport attribute on Windows. */
|
||||||
|
bool dllExport;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|||||||
3
main.cpp
3
main.cpp
@@ -153,6 +153,7 @@ devUsage(int ret) {
|
|||||||
lPrintVersion();
|
lPrintVersion();
|
||||||
printf("\nusage (developer options): ispc\n");
|
printf("\nusage (developer options): ispc\n");
|
||||||
printf(" [--debug]\t\t\t\tPrint information useful for debugging ispc\n");
|
printf(" [--debug]\t\t\t\tPrint information useful for debugging ispc\n");
|
||||||
|
printf(" [--dllexport]\t\t\tMake non-static functions DLL exported. Windows only.\n");
|
||||||
printf(" [--fuzz-test]\t\t\tRandomly perturb program input to test error conditions\n");
|
printf(" [--fuzz-test]\t\t\tRandomly perturb program input to test error conditions\n");
|
||||||
printf(" [--fuzz-seed=<value>]\t\tSeed value for RNG for fuzz testing\n");
|
printf(" [--fuzz-seed=<value>]\t\tSeed value for RNG for fuzz testing\n");
|
||||||
printf(" [--opt=<option>]\t\t\tSet optimization option\n");
|
printf(" [--opt=<option>]\t\t\tSet optimization option\n");
|
||||||
@@ -379,6 +380,8 @@ int main(int Argc, char *Argv[]) {
|
|||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "--debug"))
|
else if (!strcmp(argv[i], "--debug"))
|
||||||
g->debugPrint = true;
|
g->debugPrint = true;
|
||||||
|
else if (!strcmp(argv[i], "--dllexport"))
|
||||||
|
g->dllExport = true;
|
||||||
else if (!strcmp(argv[i], "--instrument"))
|
else if (!strcmp(argv[i], "--instrument"))
|
||||||
g->emitInstrumentation = true;
|
g->emitInstrumentation = true;
|
||||||
else if (!strcmp(argv[i], "-g")) {
|
else if (!strcmp(argv[i], "-g")) {
|
||||||
|
|||||||
@@ -920,7 +920,7 @@ Module::AddFunctionDeclaration(const std::string &name,
|
|||||||
|
|
||||||
#ifdef ISPC_IS_WINDOWS
|
#ifdef ISPC_IS_WINDOWS
|
||||||
// Make export functions callable from DLLS.
|
// Make export functions callable from DLLS.
|
||||||
if (functionType->isExported) {
|
if ((g->dllExport) && (storageClass != SC_STATIC)) {
|
||||||
function->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
|
function->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user