From f1e08a23facb2d718276b3fbf59b0df2b54fceb9 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Tue, 27 May 2008 10:06:20 +0000 Subject: Changed implementation of ArgumentIsString to work with wide-character null-terminated strings on Windows. Changed Windows dynamic linker to use LoadLibraryW which is the only variant available on Windows CE. Changed GetProcAddress to explicitly named GetProcAddressA; this is implicitly the only variant available on Windows XP. Tested by compiling gluegen-rt.dll for both Windows XP and Windows CE. Also brought dynlink-unix-CustomJavaCode.java in line with modifications that were apparently hand made to the UnixDynamicLinkerImpl and MacOSXDynamicLinkerImpl classes. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@79 a78bb65f-1512-4460-ba86-f6dc96a7bf27 --- make/dynlink-unix-CustomJavaCode.java | 2 +- make/dynlink-windows-CustomJavaCode.java | 4 ++-- make/dynlink-windows.cfg | 21 +++++++++++++-------- make/stub_includes/windows/dynamic-linker.h | 5 +++-- 4 files changed, 19 insertions(+), 13 deletions(-) (limited to 'make') diff --git a/make/dynlink-unix-CustomJavaCode.java b/make/dynlink-unix-CustomJavaCode.java index 36a1603..5d10edf 100755 --- a/make/dynlink-unix-CustomJavaCode.java +++ b/make/dynlink-unix-CustomJavaCode.java @@ -6,7 +6,7 @@ public long openLibrary(String pathname) { // other words, one can actually link against the library instead of // having to dlsym all entry points. System.loadLibrary() uses // RTLD_LOCAL visibility so can't be used for this purpose. - return dlopen(pathname, RTLD_GLOBAL); + return dlopen(pathname, RTLD_LAZY | RTLD_GLOBAL); } public long lookupSymbol(long libraryHandle, String symbolName) { diff --git a/make/dynlink-windows-CustomJavaCode.java b/make/dynlink-windows-CustomJavaCode.java index 986ec81..4101f4c 100755 --- a/make/dynlink-windows-CustomJavaCode.java +++ b/make/dynlink-windows-CustomJavaCode.java @@ -1,9 +1,9 @@ public long openLibrary(String libraryName) { - return LoadLibraryA(libraryName); + return LoadLibraryW(libraryName); } public long lookupSymbol(long libraryHandle, String symbolName) { - return GetProcAddress(libraryHandle, symbolName); + return GetProcAddressA(libraryHandle, symbolName); } public void closeLibrary(long libraryHandle) { diff --git a/make/dynlink-windows.cfg b/make/dynlink-windows.cfg index 871326e..fe69e1c 100755 --- a/make/dynlink-windows.cfg +++ b/make/dynlink-windows.cfg @@ -8,18 +8,23 @@ HierarchicalNativeOutput false IncludeAs CustomJavaCode WindowsDynamicLinkerImpl dynlink-windows-CustomJavaCode.java CustomCCode #include -CustomCCode /* This typedef is only needed for VC6 */ -CustomCCode #if _MSC_VER <= 1200 +CustomCCode /* This typedef is apparently needed for compilers before VC8, +CustomCCode and for the embedded ARM compilers we're using */ +CustomCCode #if (_MSC_VER < 1400) || defined(UNDER_CE) CustomCCode typedef int intptr_t; CustomCCode #endif +CustomCCode /* GetProcAddress doesn't exist in A/W variants under desktop Windows */ +CustomCCode #ifndef UNDER_CE +CustomCCode #define GetProcAddressA GetProcAddress +CustomCCode #endif -ArgumentIsString LoadLibraryA 0 -ArgumentIsString GetProcAddress 1 +ArgumentIsString LoadLibraryW 0 +ArgumentIsString GetProcAddressA 1 Opaque long HANDLE Opaque long PROC # Hide the platform-specific functions -AccessControl GetLastError PRIVATE -AccessControl LoadLibraryA PRIVATE -AccessControl GetProcAddress PRIVATE -AccessControl FreeLibrary PRIVATE +AccessControl GetLastError PRIVATE +AccessControl LoadLibraryW PRIVATE +AccessControl GetProcAddressA PRIVATE +AccessControl FreeLibrary PRIVATE diff --git a/make/stub_includes/windows/dynamic-linker.h b/make/stub_includes/windows/dynamic-linker.h index e8a8bd5..1b06902 100755 --- a/make/stub_includes/windows/dynamic-linker.h +++ b/make/stub_includes/windows/dynamic-linker.h @@ -17,6 +17,7 @@ typedef struct _handle* HANDLE; typedef HANDLE HMODULE; typedef long LONG; typedef const char* LPCSTR; +typedef const short* LPCWSTR; typedef void* LPVOID; typedef struct _proc* PROC; typedef unsigned int* PUINT; @@ -26,6 +27,6 @@ typedef unsigned short WORD; // Dynamic loading routines WINBASEAPI DWORD WINAPI GetLastError(VOID); -WINBASEAPI HMODULE WINAPI LoadLibraryA(LPCSTR lpLibFileName); -WINBASEAPI PROC WINAPI GetProcAddress(HMODULE hModule, LPCSTR lpProcName); +WINBASEAPI HMODULE WINAPI LoadLibraryW(LPCWSTR lpLibFileName); +WINBASEAPI PROC WINAPI GetProcAddressA(HMODULE hModule, LPCSTR lpProcName); WINBASEAPI BOOL WINAPI FreeLibrary(HMODULE hLibModule); -- cgit v1.2.3