PxRevolutelJointCreate crash

I got a nasty that I can’t figure out:

physx::PxPhysics* physics = launcher->physMgr->getSDK();
physx::PxRigidActor* cam_act = scene->mDynamicBodySys->rigid_dynamic(camera);
physx::PxRigidActor* ship_act = scene->mDynamicBodySys->rigid_dynamic(ship);
physx::PxTransform v = physx::PxTransform(physx::PxVec3(0), physx::PxQuat::createIdentity());
PxRevolutelJointCreate(*physics, cam_act, v, ship_act, v); <-- Crashes on this line !!!

So I have confirmed cam_act, ship_act, physics variables are all valid pointers. And I have made a prior call to PxInitExtensions(*mSDK) without any indications of errors. It was called in another DLL however, could that be a problem?

If it’s any value to anyone, here is the assebly code:

0x100016ccd:  je     0x100016ce9               ; physx::PxRevoluteJointCreate(physx::PxPhysics&, physx::PxRigidActor*, physx::PxTransform const&, physx::PxRigidActor*, physx::PxTransform const&) + 297
0x100016ccf:  leaq   80426(%rip), %rax         ; "static const char* physx::shdfnd::ReflectionAllocator<T>::getName() [with T = physx::Ext::RevoluteJoint]"
0x100016cd6:  movq   %rax, 145795(%rip)        ; physx::shdfnd::ReflectionAllocator<physx::Ext::RevoluteJoint>::allocate(unsigned long, char const*, int)::handle
0x100016cdd:  leaq   145780(%rip), %rdi        ; guard variable for physx::shdfnd::ReflectionAllocator<physx::Ext::RevoluteJoint>::allocate(unsigned long, char const*, int)::handle
0x100016ce4:  callq  0x10002875c               ; symbol stub for: __cxa_guard_release
0x100016ce9:  callq  0x100026fc0               ; physx::shdfnd::getAllocator()
0x100016cee:  movq   (%rax), %r9                ; <-- CRASH IS HERE
0x100016cf1:  movq   145768(%rip), %rdx        ;

IDE & Platform:
XCode 5
OSX 10.8 64-bit
PhysX 3.2.1 64-bit


The problem you’re seeing is that you don’t have a pointer to the allocator. To resolve this you need to call PxInitExtensions from the dll where you call PxRevolutelJointCreate.

PxInitExtensions doesn’t do much more than set the pointer to the allocator and then increment a reference count. This needs to be done once for each dll that invokes extensions functions. Please don’t forget that you need to call PxCloseExtensions during shutdown as well.



Thank you. This was the error and solution to my problem.