Writing a cross-platform Newton module

BlitzMax Forums/BlitzMax Programming/Writing a cross-platform Newton module

The only thing keeping my engine from being cross-platform compatible is the Newton module. Newton is offered in versions for Windows, Mac, and Linux, and I want to learn how to write a module that will work with all three systems.

In the Windows version, I load the dll and retrieve function pointers from it. I downloaded the NewtonSDK for Mac and Linux. The Macintosh and Linux versions contain some files like libnewton32.a, but when I tried to import the .a file (in Windows), BlitzMax said "file not recognized".

I do not have access to a Macintosh, and I have never even seen Linux.

Any advice?

if you have the time, i can USPS Priority you a Virtual PC 2007 image with Xandros 3.0 OCE ready to install BMAX and compile. im sure others may have images as well, but if you've never experienced linux before then you will really like Xandros. once you get the linux side down i dont think you will have much of an issue since the mac .a should operate the same. im sure if you ask around there may be several volunteers with macs to help you out... me included.

to answer your question though, the .a file essentially loads the DLL for you and provides you the function pointers so you dont have to retrieve them. so your extern block would look something like:
Import "libnewton.a"

Extern
	Function NewtonCreate:Byte Ptr( mallocfunc: Byte Ptr, freefunc:Byte Ptr)
EndExtern


Should the Linux or Mac .a file work on Windows?

Here is my code:
Import "libnewton.a"

Extern
	Function NewtonCreate:Byte Ptr(f:Byte Ptr,f2:Byte Ptr)
EndExtern

NewtonCreate(Null,Null)


And here is the compiler output:
Building test
Compiling:test.bmx
flat assembler  version 1.66
3 passes, 2124 bytes.
Linking:test.exe
C:/Documents and Settings/Joshua/Desktop/.bmx/test.bmx.gui.release.win32.x86.o(code+0xc4): undefined reference to `NewtonCreate'
Build Error: Failed to link C:/Documents and Settings/Joshua/Desktop/test.exe
Process complete


nope. the .a will only work for the corrosponding OS. for windows you will find Newton.lib. .lib files dont always work this way (depends on how the functions are exported) but the Newton.lib is compatible with GCC so you can import it straight up.

Could someone try this on Mac or Linux? I just tested it on Windows and it works.
?win32
Import "newton.lib"
?

?MacOS
Import "newton32.a"
?

?Linux
Import "newton.a"
?

Extern
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonTreeCollisionGetVertexListIndexListInAABB:Int(collision:Byte Ptr,p0:Byte Ptr,p1:Byte Ptr,vertexarray:Byte Ptr,vertexcount:Byte Ptr,vertexstride:Byte Ptr,indicelist:Byte Ptr,indicelistsize:Int)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonWorldForEachBodyInAABBDo(world:Byte Ptr,p0:Byte Ptr,p1:Byte Ptr,callback:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCollisionMakeUnique( nworld:Byte Ptr,collisionPtr:Byte Ptr)
	
	Function NewtonVehicleGetTireMatrix(vehicle:Byte Ptr,tireid:Int,mat:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCollisionApplyScale(NewtonCollision:Byte Ptr,scale:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreate:Byte Ptr( mallocFnt: Byte Ptr, mfreeFnt:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonDestroy(nWorld: Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUpdate(newtonWorld: Byte Ptr, time:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonDestroyAllBodies(newtonWorld: Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonSetSolverModel(newtonWorld:Byte Ptr, model:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonSetFrictionModel(newtonWorld:Byte Ptr, model:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonGetTimeStep:Float(newtonWorld:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonSetMinimumFrameRate(newtonWorld:Byte Ptr, frameRate:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonSetBodyLeaveWorldEvent(newtonWorld:Byte Ptr, BodyLeaveWorld_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonSetWorldSize(newtonWorld: Byte Ptr, minPoint: Byte Ptr, maxPoint:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonWorldFreezeBody(newtonWorld:Byte Ptr, body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonWorldUnfreezeBody(newtonWorld: Byte Ptr, body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonWorldForEachBodyDo(newtonWorld:Byte Ptr, BodyIterator_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonWorldSetUserData(newtonWorld:Byte Ptr, userData:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonWorldGetUserData:Byte Ptr(newtonWorld:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonWorldGetVersion:Int(newtonWorld:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonWorldRayCast(newtonWorld:Byte Ptr, p0:Byte Ptr, p1:Byte Ptr, WorldRayFilterCallback:Byte Ptr, userData:Byte Ptr,WorldRayPrefilterCallback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonWorldCollide:Int(newtonWorld:Byte Ptr, maxSize:Int,collsionA:Byte Ptr, matrixA:Byte Ptr, collsionB:Byte Ptr, matrixB:Byte Ptr, contacts:Byte Ptr, normals:Byte Ptr, penetration:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialGetDefaultGroupID:Int(newtonWorld:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialCreateGroupID:Int(newtonWorld:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialDestroyAllGroupID(newtonWorld:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialSetDefaultSoftness(newtonWorld:Byte Ptr, id0:Int, id1:Int, value:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialSetDefaultElasticity(newtonWorld:Byte Ptr, id0:Int, id1:Int, elasticCoef:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialSetDefaultCollidable(newtonWorld:Byte Ptr, id0:Int, id1:Int, state:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialSetDefaultFriction(newtonWorld:Byte Ptr, id0:Int, id1:Int, staticFriction:Float, kineticFriction:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialSetCollisionCallback(newtonWorld:Byte Ptr, id0:Int, id1:Int, userData:Byte Ptr, begin:Byte Ptr, process:Byte Ptr, NEnd:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialGetUserData:Byte Ptr(newtonWorld:Byte Ptr, id0:Int, id1:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialDisableContact (material:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialGetCurrentTimestep:Float(material:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialGetMaterialPairUserData:Byte Ptr(material:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialGetContactFaceAttribute:Int(material: Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialGetBodyCollisionID:Int(material: Byte Ptr, body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialGetContactNormalSpeed:Float(material:Byte Ptr, contactlHandle:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialGetContactForce(material: Byte Ptr, force:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialGetContactPositionAndNormal(material:Byte Ptr, posit:Byte Ptr, normal:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialGetContactTangentDirections(material:Byte Ptr, dir0:Byte Ptr, dir:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialGetContactTangentSpeed:Float(material:Byte Ptr, NewtonContact:Byte Ptr, index:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetCentreOfMass(body:Byte Ptr,pos:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialSetContactNormalAcceleration(material:Byte Ptr,vec:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonSetPlatformArchitecture(world:Byte Ptr,mode:Int)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialSetContactSoftness(NewtonMaterial:Byte Ptr, softness:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialSetContactElasticity(NewtonMaterial:Byte Ptr, restitution:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialSetContactFrictionState(NewtonMaterial:Byte Ptr, state:Int, index:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialSetContactStaticFrictionCoef(NewtonMaterial:Byte Ptr, coef:Float, index:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialSetContactKineticFrictionCoef(NewtonMaterial:Byte Ptr, coef:Float, index:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialSetContactTangentAcceleration(NewtonMaterial:Byte Ptr, accel:Float, index:Int)
	Rem
	bbdoc: la la la
	End Rem
	
	Function NewtonMaterialSetContactNormalDirection(NewtonMaterial:Byte Ptr,normal:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonMaterialContactRotateTangentDirections(NewtonMaterial:Byte Ptr, directionVector:Byte Ptr)
	
	'================================================
	' convex collision primitives creation functions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateNull:Byte Ptr(newtonWorld:Byte Ptr)	'NewtonCollision
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateSphere:Byte Ptr(newtonWorld:Byte Ptr, radiusX:Float, radiusY:Float, radiusZ:Float, offsetMatrix:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateBox:Byte Ptr(newtonWorld:Byte Ptr, dx:Float, dy:Float, dz:Float, offsetMatrix:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateCone:Byte Ptr(newtonWorld:Byte Ptr, radius:Float, height:Float, offsetMatrix:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateCapsule:Byte Ptr(newtonWorld:Byte Ptr, radius:Float, height:Float, offsetMatrix:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateCylinder:Byte Ptr(newtonWorld:Byte Ptr, radius:Float, height:Float, offsetMatrix:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateChamferCylinder:Byte Ptr(newtonWorld:Byte Ptr, radius:Float, height:Float, offsetMatrix:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateConvexHull:Byte Ptr(newtonWorld:Byte Ptr, count:Int, vertexCloud:Byte Ptr, strideInBytes:Int, offsetMatrix:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateConvexHullModifier:Byte Ptr(newtonWorld:Byte Ptr, convexHullCollision:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConvexHullModifierGetMatrix(convexHullCollision:Byte Ptr, matrix:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConvexHullModifierSetMatrix(convexHullCollision:Byte Ptr, matrix:Byte Ptr)
		
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConvexCollisionSetUserID(convexCollision:Byte Ptr, id:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConvexCollisionGetUserID:Int(convexCollision:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConvexCollisionCalculateInertialMatrix(collision:Byte Ptr,inertia:Byte Ptr,center:Byte Ptr)
	
	'================================================
	'complex collision primitives creation functions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateCompoundCollision:Byte Ptr(newtonWorld:Byte Ptr, count:Int, collisionPrimitiveArray:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateUserMeshCollision:Byte Ptr(newtonWorld:Byte Ptr, minBox:Byte Ptr, maxBox:Byte Ptr, userData:Byte Ptr, collideCallback:Byte Ptr, rayHitCallback:Byte Ptr, destroyCallback:Byte Ptr)
	
	'================================================
	' CollisionTree Utility functions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateTreeCollision:Byte Ptr(newtonWorld:Byte Ptr, userCallback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonTreeCollisionBeginBuild(NewtonCollision: Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonTreeCollisionAddFace(NewtonCollision: Byte Ptr, vertexCount:Int, vertexPtr: Byte Ptr, strideInBytes:Int, faceAttribute:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonTreeCollisionEndBuild(NewtonCollision: Byte Ptr, optimize:Int)
	'	NEWTON_API void NewtonTreeCollisionSerialize (Const NewtonCollision* treeCollision, NewtonSerialize serializeFunction, 
	'		void* serializeHandle);
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonTreeCollisionSerialize(treeCollision:Byte Ptr,serializeFunction:Byte Ptr,serializeHandle:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateTreeCollisionFromSerialization:Byte Ptr(newtonWorld:Byte Ptr, userCallback:Byte Ptr,deserializeFunction:Byte Ptr, serializeHandle:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonTreeCollisionGetFaceAtribute:Int(NewtonCollision:Byte Ptr, faceIndexArray:Byte Ptr) 
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonTreeCollisionSetFaceAtribute(NewtonCollision: Byte Ptr, faceIndexArray: Byte Ptr, attribute:Int) 
	
	'================================================
	' Collision Miscelaneos Function
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonReleaseCollision(newtonWorld:Byte Ptr, NewtonCollision:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCollisionCalculateAABB(NewtonCollision:Byte Ptr, matrix:Byte Ptr, p0:Byte Ptr, p1:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCollisionRayCast:Float(NewtonCollision:Byte Ptr, p0:Byte Ptr, p1:Byte Ptr, normals:Byte Ptr, attribute:Byte Ptr)
	
	'================================================
	' transforms utility functions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonGetEulerAngle(matrix:Byte Ptr, eulersAngles:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonSetEulerAngle(eulersAngles:Byte Ptr, matrix:Byte Ptr)
	
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCollisionCollide:Int(world:Byte Ptr,maxSize:Int,collision0:Byte Ptr,matrix0:Byte Ptr,collision1:Byte Ptr,matrix1:Byte Ptr,contacts:Byte Ptr,normals:Byte Ptr,penetration:Byte Ptr)
	
	'================================================
	' body manipulation functions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateBody:Byte Ptr(newtonWorld:Byte Ptr, NewtonCollision:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonDestroyBody(newtonWorld:Byte Ptr, body:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyAddForce(body:Byte Ptr, force:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyAddTorque(body:Byte Ptr, torque:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetMatrix(body:Byte Ptr, matrix:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetMatrixRecursive(body:Byte Ptr, matrix:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetMassMatrix(body:Byte Ptr, mass:Float, Ixx:Float, Iyy:Float, Izz:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetMaterialGroupID(body:Byte Ptr, id:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetContinuousCollisionMode(body:Byte Ptr, state:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetJointRecursiveCollision(body:Byte Ptr, state:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetOmega(body:Byte Ptr, omega:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetVelocity(body:Byte Ptr, velocity:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetForce (body:Byte Ptr, force:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetTorque(body:Byte Ptr, torque:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetLinearDamping(body:Byte Ptr, linearDamp:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetAngularDamping(body:Byte Ptr, angularDamp:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetUserData(body:Byte Ptr, userData:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyCoriolisForcesMode(body:Byte Ptr, mode:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetCollision(body:Byte Ptr, collision:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetAutoFreeze(body:Byte Ptr, state:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetFreezeTreshold(body:Byte Ptr, freezeSpeed2:Float, freezeOmega2:Float, framesCount:Int)
		
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetTransformCallback(body:Byte Ptr, SetTransform_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetDestructorCallback(body:Byte Ptr, BodyDest_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetAutoactiveCallback(body:Byte Ptr, BodyActState_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodySetForceAndTorqueCallback(body:Byte Ptr, ApplyForceTorque_callback:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetWorld:Byte Ptr(body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetUserData:Byte Ptr(body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetCollision:Byte Ptr(body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetMaterialGroupID:Int(body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetContinuousCollisionMode:Int(body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetJointRecursiveCollision:Int(body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetMatrix(body:Byte Ptr, matrix:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetMassMatrix(body:Byte Ptr, mass:Byte Ptr, Ixx:Byte Ptr, Iyy:Byte Ptr, Izz:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetInvMass(body:Byte Ptr, invMass:Byte Ptr, invIxx:Byte Ptr, invIyy:Byte Ptr, invIzz:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetOmega(body:Byte Ptr, vector:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetVelocity(body:Byte Ptr, vector:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetForce(body:Byte Ptr, vector:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetTorque(body:Byte Ptr, vector:Byte Ptr)
		
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetSleepingState:Int(body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetAutoFreeze:Int(body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetLinearDamping:Float(body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetAngularDamping (body:Byte Ptr, vector:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetAABB (body:Byte Ptr, p0:Byte Ptr, p1:Byte Ptr)	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetFreezeTreshold(body:Byte Ptr, freezeSpeed2:Byte Ptr, freezeOmega2:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyGetTotalVolume:Float(body:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyAddBuoyancyForce(body:Byte Ptr, fluidDensity:Float, fluidLinearViscosity:Float, fluidAngularViscosity:Float,gravityVector:Byte Ptr, buoyancyPlane:Byte Ptr, context:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBodyForEachPolygonDo (body:Byte Ptr, CollisionIterator_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonAddBodyImpulse(body:Byte Ptr, pointDeltaVeloc:Byte Ptr, pointPosit:Byte Ptr)
	
	'================================================
	' Common joint funtions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonJointGetUserData:Byte Ptr(joint:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonJointSetUserData(joint:Byte Ptr, userData:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonJointGetCollisionState:Int(joint:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonJointSetCollisionState(joint:Byte Ptr, state:Int)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonJointGetStiffness:Float(joint:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonJointSetStiffness(joint:Byte Ptr, state:Float)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonDestroyJoint(newtonWorld:Byte Ptr, joint:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonJointSetDestructor(joint:Byte Ptr, destructor:Byte Ptr)
	
	'================================================
	' Ball And Socket joint functions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConstraintCreateBall:Byte Ptr(newtonWorld:Byte Ptr, pivotPoint:Byte Ptr, childBody:Byte Ptr, parentBody:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBallSetUserCallback(ball:Byte Ptr, BallCallBack_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBallGetJointAngle (ball:Byte Ptr, angle:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBallGetJointOmega (ball:Byte Ptr, omega:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBallGetJointForce (ball:Byte Ptr, force:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonBallSetConeLimits (ball:Byte Ptr, pin:Byte Ptr, maxConeAngle:Float, maxTwistAngle:Float)
	
	'================================================
	' Hinge joint functions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConstraintCreateHinge:Byte Ptr(newtonWorld:Byte Ptr, pivotPoint:Byte Ptr, pinDir:Byte Ptr, childBody:Byte Ptr, parentBody:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonHingeSetUserCallback(hinge:Byte Ptr, HingeCallBack_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonHingeGetJointAngle:Float(hinge:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonHingeGetJointOmega:Float(hinge:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonHingeGetJointForce(hinge:Byte Ptr,  force:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonHingeCalculateStopAlpha:Float(hinge:Byte Ptr, desc:Byte Ptr, angle:Float)
	
	
	'================================================
	' Slider joint functions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConstraintCreateSlider:Byte Ptr(newtonWorld:Byte Ptr,pivotPoint:Byte Ptr, pinDir:Byte Ptr, childBody:Byte Ptr, parentBody:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonSliderSetUserCallback(slider:Byte Ptr, SliderCallBack_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonSliderGetJointPosit:Float(slider:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonSliderGetJointVeloc:Float(slider:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonSliderGetJointForce (slider:Byte Ptr,  force:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonSliderCalculateStopAccel:Float(slider:Byte Ptr, desc:Byte Ptr, position:Float)
	
	
	'================================================
	' Corkscrew joint functions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConstraintCreateCorkscrew:Byte Ptr(newtonWorld:Byte Ptr,pivotPoint:Byte Ptr, pinDir:Byte Ptr, childBody:Byte Ptr, parentBody:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCorkscrewSetUserCallback(corkscrew:Byte Ptr, CorkscrewCallBack_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCorkscrewGetJointPosit:Float (corkscrew:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCorkscrewGetJointAngle:Float( corkscrew:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCorkscrewGetJointVeloc:Float(corkscrew:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCorkscrewGetJointOmega:Float( corkscrew:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCorkscrewGetJointForce(corkscrew:Byte Ptr, force:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCorkscrewCalculateStopAlpha:Float(corkscrew:Byte Ptr, desc:Byte Ptr, angle:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCorkscrewCalculateStopAccel:Float(corkscrew:Byte Ptr, desc:Byte Ptr, position:Float)
	
	
	'================================================
	' Universal joint functions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConstraintCreateUniversal:Byte Ptr(newtonWorld:Byte Ptr, pivotPoint:Byte Ptr, pinDir0:Byte Ptr, pinDir1:Byte Ptr, childBody:Byte Ptr, parentBody:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUniversalSetUserCallback(universal:Byte Ptr, UniversalCallBack_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUniversalGetJointAngle0:Float( universal:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUniversalGetJointAngle1:Float(universal:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUniversalGetJointOmega0:Float( universal:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUniversalGetJointOmega1:Float (universal:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUniversalGetJointForce(universal:Byte Ptr, force:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUniversalCalculateStopAlpha0:Float(universal:Byte Ptr, desc:Byte Ptr, angle:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUniversalCalculateStopAlpha1:Float(universal:Byte Ptr, desc:Byte Ptr, angle:Float)
	
	
	'================================================
	'Up vector joint functions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConstraintCreateUpVector:Byte Ptr(newtonWorld:Byte Ptr, pinDir:Byte Ptr, body:Byte Ptr) 
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUpVectorGetPin(upVector:Byte Ptr, pin:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUpVectorSetPin(upVector:Byte Ptr, pin:Byte Ptr)
	
	
	'================================================
	' User defined bilateral Joint
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConstraintCreateUserJoint:Byte Ptr(newtonWorld:Byte Ptr, maxDOF:Int, UserBilateralCallBack_callback:Byte Ptr, childBody:Byte Ptr, parentBody:Byte Ptr) 
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUserJointAddLinearRow(joint:Byte Ptr, pivot0:Byte Ptr, pivot1:Byte Ptr, dir:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUserJointAddAngularRow(joint:Byte Ptr, relativeAngle:Float, dir:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUserJointSetRowMinimunFriction(joint:Byte Ptr,  friction:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUserJointSetRowMaximunFriction( joint:Float, friction:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUserJointSetRowAcceleration(joint:Byte Ptr,  acceleration:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUserJointSetRowStiffness( joint:Float,stiffness:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonUserJointGetRowForce:Float(joint:Byte Ptr, row:Int)
	
	
	'================================================
	' Ragdoll joint contatiner funtion
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonCreateRagDoll:Byte Ptr(newtonWorld:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonDestroyRagDoll(newtonWorld:Byte Ptr, ragDoll:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollBegin( ragDoll:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollEnd( ragDoll:Byte Ptr)
	
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollFindBone:Byte Ptr( ragDoll:Byte Ptr, id:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollGetRootBone:Byte Ptr( ragDoll:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollSetForceAndTorqueCallback( ragDoll:Byte Ptr, ApplyForceAndTorque_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollSetTransformCallback(ragDoll:Byte Ptr, SetRagDollTransform_callback:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollAddBone:Byte Ptr(ragDoll:Byte Ptr, parent:Byte Ptr, userData:Byte Ptr, mass:Float, matrix:Byte Ptr, boneCollision:Byte Ptr, size:Byte Ptr)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollBoneGetUserData:Byte Ptr( bone:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollBoneGetBody:Byte Ptr( bone:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollBoneSetID(bone:Byte Ptr, id:Int)
	
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollBoneSetLimits(bone:Byte Ptr, coneDir:Byte Ptr, minConeAngle:Float, maxConeAngle:Float, maxTwistAngle:Float, bilateralConeDir:Byte Ptr, negativeBilateralConeAngle:Float, positiveBilateralConeAngle:Float)
		
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollBoneGetLocalMatrix(bone:Byte Ptr,  matrix:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonRagDollBoneGetFunctionMatrix( bone:Byte Ptr,  matrix:Byte Ptr)
	
	
	'================================================
	' Vehicle joint functions
	'================================================
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonConstraintCreateVehicle:Byte Ptr(newtonWorld:Byte Ptr, upDir:Byte Ptr, body:Byte Ptr) 
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleReset(vehicle:Byte Ptr) 
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleSetTireCallback(vehicle:Byte Ptr, update:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleAddTire:Int(vehicle:Byte Ptr, localMatrix:Byte Ptr, pin:Byte Ptr, mass:Float, width:Float, radius:Float, suspesionShock:Float, suspesionSpring:Float, suspesionLength:Float, userData:Byte Ptr, collisionID:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleRemoveTire(vehicle:Byte Ptr, tireIndex:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleBalanceTires(vehicle:Byte Ptr, gravityMag:Float)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleGetFirstTireID:Int(vehicle:Byte Ptr)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleGetNextTireID:Int(vehicle:Byte Ptr, tireId:Int)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleTireIsAirBorne:Int (vehicle:Byte Ptr, tireId:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleTireLostSideGrip:Int(vehicle:Byte Ptr, tireId:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleTireLostTraction:Int(vehicle:Byte Ptr, tireId:Int)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleGetTireUserData:Byte Ptr(vehicle:Byte Ptr, tireId:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleGetTireOmega:Float(vehicle:Byte Ptr, tireId:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleGetTireNormalLoad:Float(vehicle:Byte Ptr, tireId:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleGetTireSteerAngle:Float (vehicle:Byte Ptr, tireId:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleGetTireLateralSpeed:Float(vehicle:Byte Ptr, tireId:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleGetTireLongitudinalSpeed:Float(vehicle:Byte Ptr, tireId:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function hicleGetTireMatrix(vehicle:Byte Ptr, tireId:Int , matrix:Byte Ptr)
	
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleSetTireTorque(vehicle:Byte Ptr, tireId:Int, torque:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleSetTireSteerAngle(vehicle:Byte Ptr, tireId:Int,  angle:Float)
		
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleSetTireMaxSideSleepSpeed(vehicle:Byte Ptr, tireId:Int, speed:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleSetTireSideSleepCoeficient(vehicle:Byte Ptr, tireId:Int,  coeficient:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleSetTireMaxLongitudinalSlideSpeed(vehicle:Byte Ptr, tireId:Int, speed:Float)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleSetTireLongitudinalSlideCoeficient(vehicle:Byte Ptr, tireId:Int, coeficient:Float)
	
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleTireCalculateMaxBrakeAcceleration:Float(vehicle:Byte Ptr, tireId:Int)
	Rem
	bbdoc: la la la
	End Rem
	Function NewtonVehicleTireSetBrakeAcceleration(vehicle:Byte Ptr, tireId:Int,  accelaration:Float, torqueLimit:Float)
	
EndExtern


i had to rename the stock distro libs to match your imports. i also had to run ranlib on the mac .a file. i used the following code and got a valid handle on all 3 OS (mac is an intel). i would say you are on the right track :)
Local newton:Byte Ptr=NewtonCreate(PhysicsAlloc,PhysicsFree)
Print Int(newton)

NewtonDestroy(newton)

Function PhysicsAlloc:Byte Ptr(sizeInBytes:Int)
	Return MemAlloc(sizeInBytes)
EndFunction

Function PhysicsFree(memptr:Byte Ptr,sizeInBytes:Int)
	MemFree(memptr)
EndFunction


I don't have a Mac, so it's up to someone else to finish.

Leadwerks: Here is my crossplattform Newton module for BMax:
http://www.btbn.de/ModServer/index.php?only_mod=klepto.newton

It is mainly based on your original module but without the need of the windows dll. Also it works unfortunatly only for MacOS 10.5 and higher (thats related to newton itself).

Feel free to use it any way you want.

What is a .zap file?

It's a BlitzMax format - a compressed module. You have to unzap it to use it.

And how do I do that?

Oh, I figured it out.

Where did you find libNewtonWin32.a? All I have for Windows are .lib and .dll files. I have a beta build of Newton, so I need to figure out how to do this myself.

Well, I have it from this address:
http://www.newtondynamics.com/downloads/NewtonMinGW-1.53.zip

And found it in this post:
http://www.physicsengine.com/forum/viewtopic.php?t=2604&postdays=0&postorder=asc&highlight=mingw&start=15

If you have a beta, I think you have to ask if it is again possilble to build a static mingw lib. Else you have to stay with the small provided .a file and provide the dll on windows.

btw: Is the beta you're testing already providing things Julio Jerez has mentioned in his posts or does it only have some things you have needed?

Seems like there are some compatability issues there. What was the final conclusion on whether that would work or not?