aboutsummaryrefslogtreecommitdiff
path: root/APEX_1.4/framework
diff options
context:
space:
mode:
authorSheikh Dawood Abdul Ajees <[email protected]>2018-01-26 19:43:03 -0600
committerSheikh Dawood Abdul Ajees <[email protected]>2018-01-26 19:43:03 -0600
commitb6db9a56548cd1c41bee309e721d76ea2c9320da (patch)
tree1f0436b187db50c21e576b4f4d491530113c91bc /APEX_1.4/framework
parentPhysX 3.4.1, APEX 1.4.1 Release @23307153 (diff)
downloadphysx-3.4-b6db9a56548cd1c41bee309e721d76ea2c9320da.tar.xz
physx-3.4-b6db9a56548cd1c41bee309e721d76ea2c9320da.zip
PhysX 3.4, APEX 1.4 patch release @23472123
Diffstat (limited to 'APEX_1.4/framework')
-rw-r--r--APEX_1.4/framework/src/ApexSDKImpl.cpp57
1 files changed, 55 insertions, 2 deletions
diff --git a/APEX_1.4/framework/src/ApexSDKImpl.cpp b/APEX_1.4/framework/src/ApexSDKImpl.cpp
index 4fda19b0..b3394516 100644
--- a/APEX_1.4/framework/src/ApexSDKImpl.cpp
+++ b/APEX_1.4/framework/src/ApexSDKImpl.cpp
@@ -83,6 +83,10 @@
#include <dlfcn.h>
#endif
+#if PX_LINUX && APEX_LINUX_SHARED_LIBRARIES
+#include <dlfcn.h>
+#endif
+
#if PX_X86
#define PTR_TO_UINT64(x) ((uint64_t)(uint32_t)(x))
#else
@@ -114,7 +118,7 @@ namespace apex
extern ApexSDKImpl* gApexSdk;
-#if defined(_USRDLL) || PX_OSX
+#if defined(_USRDLL) || PX_OSX || (PX_LINUX && APEX_LINUX_SHARED_LIBRARIES)
typedef Module* (NxCreateModule_FUNC)(ApexSDKIntl*, ModuleIntl**, uint32_t, uint32_t, ApexCreateError*);
#else
/* When modules are statically linked, the user must instantiate modules manually before they can be
@@ -793,7 +797,7 @@ Module* ApexSDKImpl::createModule(const char* name, ApexCreateError* err)
Module* newModule = NULL;
ModuleIntl* newIModule = NULL;
-#if defined(_USRDLL) || PX_OSX
+#if defined(_USRDLL) || PX_OSX || (PX_LINUX && APEX_LINUX_SHARED_LIBRARIES)
/* Dynamically linked module libraries */
#if defined(WIN32)
@@ -894,6 +898,55 @@ Module* ApexSDKImpl::createModule(const char* name, ApexCreateError* err)
err);
}
}
+#elif (PX_LINUX && APEX_LINUX_SHARED_LIBRARIES)
+ ApexSimpleString soName = ApexSimpleString("libAPEX_") + ApexSimpleString(name);
+
+#if _DEBUG
+ // Request DEBUG so unless the user has explicitly asked for it
+ const size_t nameLen = strlen(name);
+ if (nameLen <= 5 || nvidia::strcmp(name + nameLen - 5, "DEBUG"))
+ {
+ soName += ApexSimpleString("DEBUG");
+ }
+#elif PX_CHECKED
+ soName += ApexSimpleString("CHECKED");
+#elif defined(PHYSX_PROFILE_SDK)
+ soName += ApexSimpleString("PROFILE");
+#endif
+ soName += mCustomDllNamePostfix;
+
+ soName += ApexSimpleString(".so");
+
+ ApexSimpleString soPath = mDllLoadPath + soName;
+
+ void* library = NULL;
+ {
+ // Check if so is already loaded
+ library = dlopen(soPath.c_str(), RTLD_NOLOAD | RTLD_LAZY | RTLD_LOCAL);
+ if (!library)
+ {
+ // Not loaded yet, so try to open it
+ library = dlopen(soPath.c_str(), RTLD_LAZY | RTLD_LOCAL);
+ }
+ if (!library)
+ {
+ // Still not loaded yet, so lets just try the soName
+ library = dlopen(soName.c_str(), RTLD_LAZY | RTLD_LOCAL);
+ }
+ }
+
+ if (library)
+ {
+ NxCreateModule_FUNC* createModuleFunc = (NxCreateModule_FUNC*)dlsym(library, "createModule");
+ if (createModuleFunc)
+ {
+ newModule = createModuleFunc((ApexSDKIntl*) this,
+ &newIModule,
+ APEX_SDK_VERSION,
+ PX_PHYSICS_VERSION,
+ err);
+ }
+ }
#else
/* TODO: other platform dynamic linking? */
#endif