In these modern times if you run Windows with UAC turned on its not ok
to write temporary files to c:\ so I had to make some trivial changes to
CreatDLL.cpp to make is use a more appropriate place to create its
temporary files.
Apply the patch with something like:
% cd ilmbase/vc/createDLL ; patch -p0 < ~/createDLL.patch
- James.
------------------------------------------------------------------------
--- createDLL.cpp.ORIG 2006-12-11 00:36:52.000000000 -0800
+++ createDLL.cpp 2007-08-21 22:10:22.786393300 -0700
@@ -653,9 +653,9 @@
}
-static void createResponseFile(string& path, string& moduleName, vector<string>& libpath, string& implib, set<string>& libs, set<string>& objs, bool noDefaultLibs)
+static void createResponseFile(string& repFile, string& path, string& moduleName, vector<string>&
libpath, string& implib, set<string>& libs, set<string>& objs, bool noDefaultLibs)
{
- FILE* r = fopen("C:\\response.txt", "wb");
+ FILE* r = fopen(repFile.c_str(), "wb");
if (r != 0)
{
fprintf(r, "/OUT:\"%s\\%s.dll\" /NOLOGO ", path.c_str(),
moduleName.c_str());
@@ -728,8 +728,24 @@
std::cout << "CreateDLL v1.1" << std::endl;
+ char tempDir[MAX_PATH];
+ int rt = GetTempPath(MAX_PATH, tempDir);
+ // 20 less because we have to have room for the filename
+ if (rt == 0 || rt > MAX_PATH - 20) {
+ std::cerr << "Failed to get temp dir\n";
+ return 1;
+ }
+
+ std::string repFile(tempDir);
+ repFile += "response.txt";
+
+ std::string logName(tempDir);
+ logName += "createDLL_out.txt";
+
+ std::cout << "Linker response file is " << repFile << "\n";
+ std::cout << "Log file is " << logName << "\n";
// banner
- std::ofstream logfile("c:\\createDLL_out.txt", std::ios::out);
+ std::ofstream logfile(logName.c_str(), std::ios::out);
logfile << "createDLL was built " << __DATE__ << " " << __TIME__ << endl;
if (mapFileName == "" || importlib == "")
@@ -856,7 +872,7 @@
// silly placeholder code, given the comment above :\
string impliblib = importlib + ".lib";
- createResponseFile(path, moduleName, libpaths, impliblib, libs, objs, noDefaultLib);
+ createResponseFile(repFile, path, moduleName, libpaths, impliblib,
libs, objs, noDefaultLib);
// invoke linker
cerr << "Exporting DLL" << endl;
@@ -864,8 +880,11 @@
// run the linker
char** new_argv = new char *[3];
size_t new_argc = 0;
+ std::string repFileArg("@");
+ repFileArg += repFile;
+
new_argv[0] = "createDLL";
- new_argv[1] = "@C:\\response.txt";
+ new_argv[1] = (char*)repFileArg.c_str();
new_argv[2] = 0;
int status = -1;
------------------------------------------------------------------------
_______________________________________________
Openexr-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/openexr-devel