summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/DynamicLoader.cxx
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2006-03-10 16:32:09 (GMT)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2006-03-10 16:32:09 (GMT)
commit011de35360e8f3b22809f21055ccaff62ba7b212 (patch)
tree1abaa5b0be67e8962eef42e7de3c5b1f25ba0f1d /Source/kwsys/DynamicLoader.cxx
parent6b47b288678569a630c14af24200ec6f3736218a (diff)
downloadCMake-011de35360e8f3b22809f21055ccaff62ba7b212.zip
CMake-011de35360e8f3b22809f21055ccaff62ba7b212.tar.gz
CMake-011de35360e8f3b22809f21055ccaff62ba7b212.tar.bz2
ENH: Hopefully have the DynamicLoader to the proper thing.
Diffstat (limited to 'Source/kwsys/DynamicLoader.cxx')
-rw-r--r--Source/kwsys/DynamicLoader.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx
index 8584a84..cc6a1d5 100644
--- a/Source/kwsys/DynamicLoader.cxx
+++ b/Source/kwsys/DynamicLoader.cxx
@@ -220,12 +220,24 @@ int DynamicLoader::CloseLibrary(LibHandle lib)
DynamicLoaderFunction DynamicLoader::GetSymbolAddress(LibHandle lib, const char* sym)
{
void *result;
+#ifdef __BORLANDC__
+ // Need to prepend symbols with '_' on borland compilers
+ size_t len = strlen(sym);
+ char *rsym = new char[len + 1 + 1];
+ strcpy(rsym, "_");
+ strcat(rsym+1, sym);
+#else
+ const char *rsym = sym;
+#endif
#ifdef UNICODE
wchar_t wsym[MB_CUR_MAX];
- mbstowcs(wsym, sym, MB_CUR_MAX);
+ mbstowcs(wsym, rsym, MB_CUR_MAX);
result = GetProcAddress(lib, wsym);
#else
- result = (void*)GetProcAddress(lib, sym);
+ result = (void*)GetProcAddress(lib, rsym);
+#endif
+#ifdef __BORLANDC__
+ delete[] rsym;
#endif
// Hack to cast pointer-to-data to pointer-to-function.
return *reinterpret_cast<DynamicLoaderFunction*>(&result);
@@ -317,7 +329,11 @@ const char* DynamicLoader::LibPrefix()
//----------------------------------------------------------------------------
const char* DynamicLoader::LibExtension()
{
+#ifdef __CYGWIN__
+ return ".dll";
+#else
return ".so";
+#endif
}
//----------------------------------------------------------------------------