Index: llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt =================================================================== --- llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt +++ llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt @@ -1,7 +1,9 @@ set(LLVM_LINK_COMPONENTS Support) -add_llvm_unittest(DynamicLibraryTests DynamicLibraryTest.cpp) +add_library(DynamicLibraryLib STATIC ExportedFuncs.cxx) +add_llvm_unittest(DynamicLibraryTests DynamicLibraryTest.cpp) +target_link_libraries(DynamicLibraryTests DynamicLibraryLib) export_executable_symbols(DynamicLibraryTests) function(dynlib_add_module NAME) Index: llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp =================================================================== --- llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp +++ llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp @@ -19,8 +19,6 @@ using namespace llvm; using namespace llvm::sys; -extern "C" PIPSQUEAK_EXPORT const char *TestA() { return "ProcessCall"; } - std::string LibPath(const std::string Name = "PipSqueak") { const std::vector& Argvs = testing::internal::GetArgvs(); const char *Argv0 = Argvs.size() > 0 ? Argvs[0].c_str() : "DynamicLibraryTests"; Index: llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx =================================================================== --- llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx +++ llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx @@ -0,0 +1,16 @@ +//===- llvm/unittest/Support/DynamicLibrary/DynamicLibraryLib.cpp ---------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "PipSqueak.h" + +#ifndef PIPSQUEAK_TESTA_RETURN +#define PIPSQUEAK_TESTA_RETURN "ProcessCall" +#endif + +extern "C" PIPSQUEAK_EXPORT const char *TestA() { return PIPSQUEAK_TESTA_RETURN; } Index: llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.h =================================================================== --- llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.h +++ llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.h @@ -29,4 +29,6 @@ #define PIPSQUEAK_EXPORT #endif +extern "C" PIPSQUEAK_EXPORT const char *TestA(); + #endif Index: llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx =================================================================== --- llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx +++ llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx @@ -45,4 +45,5 @@ Glb.Vec = &V; } -extern "C" PIPSQUEAK_EXPORT const char *TestA() { return "LibCall"; } +#define PIPSQUEAK_TESTA_RETURN "LibCall" +#include "ExportedFuncs.cxx"