This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: dladdr and Dl_info
Reini Urban schrieb:
cygwin has only dlsym() not the SGI DL_info + dladdr() yet.
clang just needs it to get the path for the CIndex dll.
This should be possible with the code in the LLVM_ON_WIN32 section,
and convert then the path from win to posix with cygwin_conv_path().
Attached is the untested patch.
--
Reini Urban
http://phpwiki.org/ http://murbreak.at/
Index: tools/CIndex/CIndexer.cpp
===================================================================
--- tools/CIndex/CIndexer.cpp (revision 93449)
+++ tools/CIndex/CIndexer.cpp (working copy)
@@ -31,7 +31,7 @@
#include <vector>
#include <sstream>
-#ifdef LLVM_ON_WIN32
+#if defined(LLVM_ON_WIN32) || defined(__CYGWIN__)
#include <windows.h>
#else
#include <dlfcn.h>
@@ -46,14 +46,19 @@
return ClangPath;
// Find the location where this library lives (libCIndex.dylib).
-#ifdef LLVM_ON_WIN32
+#if defined(LLVM_ON_WIN32) || defined(__CYGWIN__)
MEMORY_BASIC_INFORMATION mbi;
char path[MAX_PATH];
VirtualQuery((void *)(uintptr_t)clang_createTranslationUnit, &mbi,
sizeof(mbi));
GetModuleFileNameA((HINSTANCE)mbi.AllocationBase, path, MAX_PATH);
-
+#ifdef __CYGWIN__
+ char posix_path[MAX_PATH];
+ cygwin_conv_path(CCP_WIN_A_TO_POSIX | CCP_RELATIVE, path, posix_path, MAX_PATH);
+ llvm::sys::Path CIndexPath(posix_path);
+#else
llvm::sys::Path CIndexPath(path);
+#endif
CIndexPath.eraseComponent();
CIndexPath.appendComponent("clang");
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple