Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c2
-rw-r--r--bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c30
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipseOS.h4
3 files changed, 29 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
index 59eae8c2c..7099c604d 100644
--- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
+++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
@@ -242,7 +242,7 @@ char * findVMLibrary( char* command ) {
free(version);
}
}
- return "/System/Library/Frameworks/JavaVM.framework/Versions/Current/JavaVM";
+ return JAVA_FRAMEWORK;
}
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c
index 00275f86c..0b0f33cf1 100644
--- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c
+++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c
@@ -23,6 +23,8 @@
char dirSeparator = '/';
char pathSeparator = ':';
+static CFBundleRef javaVMBundle = NULL;
+
void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash );
int initialized = 0;
@@ -95,22 +97,38 @@ void displayMessage(char *title, char *message)
/* Load the specified shared library
*/
void * loadLibrary( char * library ){
- void * result= dlopen(library, RTLD_NOW);
- if(result == 0)
- printf("%s\n",dlerror());
- return result;
+ if (strcmp(library, JAVA_FRAMEWORK) == 0) {
+ CFURLRef url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8 *)JAVA_FRAMEWORK, strlen(JAVA_FRAMEWORK), true);
+ javaVMBundle = CFBundleCreate(kCFAllocatorDefault, url);
+ CFRelease(url);
+ return (void*) &javaVMBundle;
+ } else {
+ void * result= dlopen(library, RTLD_NOW);
+ if(result == 0)
+ printf("%s\n",dlerror());
+ return result;
+ }
}
/* Unload the shared library
*/
void unloadLibrary( void * handle ){
- dlclose(handle);
+ if (handle == &javaVMBundle)
+ CFRelease(javaVMBundle);
+ else
+ dlclose(handle);
}
/* Find the given symbol in the shared library
*/
void * findSymbol( void * handle, char * symbol ){
- return dlsym(handle, symbol);
+ if(handle == &javaVMBundle) {
+ CFStringRef string = CFStringCreateWithCString(kCFAllocatorDefault, symbol, kCFStringEncodingASCII);
+ void * ptr = CFBundleGetFunctionPointerForName(javaVMBundle, string);
+ CFRelease(string);
+ return ptr;
+ } else
+ return dlsym(handle, symbol);
}
char * resolveSymlinks( char * path ) {
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseOS.h b/bundles/org.eclipse.equinox.executable/library/eclipseOS.h
index a4d5ce26b..1e33cf612 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipseOS.h
+++ b/bundles/org.eclipse.equinox.executable/library/eclipseOS.h
@@ -37,6 +37,10 @@
#define secondThread secondThreadW
#endif
+#ifdef MACOSX
+#define JAVA_FRAMEWORK "/System/Library/Frameworks/JavaVM.framework"
+#endif
+
/* Operating System Dependent Information */
/*** See eclipse.c for information on the launcher runtime architecture ***/

Back to the top