From f5f1ebfa9ae48e378360924817c24f9478a1b973 Mon Sep 17 00:00:00 2001 From: Oliver Bock <oliver.bock@aei.mpg.de> Date: Wed, 30 Apr 2008 15:02:02 +0200 Subject: [PATCH] Using explicit linkage --- ResourceFactory.h | 6 +++--- Starsphere.h | 12 ++++++------ orc/ResourceCompiler.cpp | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ResourceFactory.h b/ResourceFactory.h index a5bae67..27c6286 100644 --- a/ResourceFactory.h +++ b/ResourceFactory.h @@ -64,7 +64,7 @@ private: * \todo Does this need to be global? * Maybe we should wrap a class around the generated resources? */ -extern const string c_ResourceIdentifiers[]; +extern "C++" const string c_ResourceIdentifiers[]; /** * \brief Declaration of the external list of resource indices @@ -78,7 +78,7 @@ extern const string c_ResourceIdentifiers[]; * \todo Does this need to be global? * Maybe we should wrap a class around the generated resources? */ -extern const unsigned int c_ResourceIndex[][2]; +extern "C++" const unsigned int c_ResourceIndex[][2]; /** * \brief Declaration of the external resource storage container @@ -90,6 +90,6 @@ extern const unsigned int c_ResourceIndex[][2]; * \todo Does this need to be global? * Maybe we should wrap a class around the generated resources? */ -extern const unsigned char c_ResourceStorage[]; +extern "C++" const unsigned char c_ResourceStorage[]; #endif /*RESOURCEFACTORY_H_*/ diff --git a/Starsphere.h b/Starsphere.h index a41e875..312bb7e 100644 --- a/Starsphere.h +++ b/Starsphere.h @@ -216,15 +216,15 @@ private: }; /* Constellation & star coordinates are in starlist.C */ -extern float star_info[][2]; -extern int Nstars; +extern "C" float star_info[][2]; +extern "C" int Nstars; /* Pulsar coordinates are in pulsar_list.C */ -extern float pulsar_info[][2]; -extern int Npulsars; +extern "C" float pulsar_info[][2]; +extern "C" int Npulsars; /* SNR coordinates are in snr_list.C */ -extern float SNR_info[][2]; -extern int NSNRs; +extern "C" float SNR_info[][2]; +extern "C" int NSNRs; #endif /*STARSPHERE_H_*/ diff --git a/orc/ResourceCompiler.cpp b/orc/ResourceCompiler.cpp index d67c5b6..d81e9bc 100644 --- a/orc/ResourceCompiler.cpp +++ b/orc/ResourceCompiler.cpp @@ -64,17 +64,17 @@ void ResourceCompiler::compile() // write code file contents (remove trailing commas) string output = resourceIdentifierInitializer.str(); - outputFile << "std::string c_ResourceIdentifiers[] = {" << endl; + outputFile << "extern \"C++\" const std::string c_ResourceIdentifiers[] = {" << endl; outputFile << output.substr(0, output.length() - 1); outputFile << endl << "};" << endl << endl; output = resourceIndexInitializer.str(); - outputFile << "unsigned int c_ResourceIndex[][2] = {" << endl; + outputFile << "extern \"C++\" const unsigned int c_ResourceIndex[][2] = {" << endl; outputFile << output.substr(0, output.length() - 1); outputFile << endl << "};" << endl << endl; output = resourceStorageInitializer.str(); - outputFile << "unsigned char c_ResourceStorage[] = {" << endl; + outputFile << "extern \"C++\" const unsigned char c_ResourceStorage[] = {" << endl; outputFile << output.substr(0, output.length() - 1); outputFile << endl << "};" << endl << endl; } -- GitLab