Author Topic: Attempt to make dll wrapper, compiles no errors, but no success.  (Read 7406 times)

Offline aonyn

  • Mr. Polyvector
  • ***
  • Posts: 136
    • View Profile
Hi All,

I am attempting to wrap a dll, specifically, a new xors3d wrapper.
I am aware one exists, but I want to learn, and I understand the existing wrapper is no longer maintained anyway.
If I can successfully wrap xors3d, of course it will be my contribution to the community, and will be a nice compliment to bigsofty's ixors3d wrapper.

Anyway, I have one of the working samples from the purebasic version translated to glbasic, and necessary functions are wrapped to support the sample.
It compiles with no errors, but does not work as expected.
The wrapper file is added to the project, the dll files provided with the xors3d demo are place in the app folder inside the project, and the texture is placed in app's media folder, in a subfolder called textures

If someone sees what I am doing wrong, please provide me some feedback, so I can continue moving forward.
This is my first adventure with inline code, and I am working from Gernot's dll wrapping tutorial, as well as looking at how the purebasic wrapper is built for comparison.

Here is the sample code
Code: (glbasic) [Select]
// --------------------------------- //
// Project: xors3d headers
// Start: Monday, September 13, 2010
// IDE Version: 8.085

// Sample xors3d usage

//GLOBAL KEY_ESCAPE% = 01
//GLOBAL KEY_W% = 17
//GLOBAL KEY_S% = 31
//GLOBAL KEY_A% = 30
//GLOBAL KEY_D% = 32

GLOBAL KEY_ESCAPE% = 27
GLOBAL KEY_W% = 87
GLOBAL KEY_S% = 83
GLOBAL KEY_A% = 65
GLOBAL KEY_D% = 68

// setup maximum supported AntiAlias TYPE
xSetAntiAliasType(xGetMaxAntiAlias())

// set application window caption
xAppTitle("Simple sample")

// initialize graphics mode
xGraphics3D(800, 600, 32, FALSE, TRUE)

// hide mouse pointer
xHidePointer()

// enable antialiasing
xAntiAlias(TRUE)

// create camera
LOCAL camera% = xCreateCamera(0)

// position camera
xPositionEntity(camera, 0, 0, -10)

// create cube
LOCAL cube% = xCreateCube(0)

// loading logo from file
LOCAL logoTexture% = xLoadTexture("Media\Textures\logo.jpg")

// texture cube
xEntityTexture(cube, logoTexture)

// for mouse look
xMoveMouse(xGraphicsWidth()*0.5, xGraphicsHeight()*0.5)
LOCAL mousespeed# = 0.5
LOCAL camerasmoothness# = 4.5

// main program loop
WHILE NOT xKeyDown(KEY_ESCAPE)
IF xKeyDown(KEY_W)
xMoveEntity(camera,  0,  0,  1)
ENDIF

IF xKeyDown(KEY_S)
xMoveEntity(camera,  0,  0, -1)
ENDIF

IF xKeyDown(KEY_A)
xMoveEntity(camera, -1,  0,  0)
ENDIF

IF xKeyDown(KEY_D)
xMoveEntity(camera,  1,  0,  0)
ENDIF

LOCAL mxs# = 0.0
LOCAL mys# = 0.0

mxs = CurveValue(xMouseXSpeed() * mousespeed, mxs, camerasmoothness)
mys = CurveValue(xMouseYSpeed() * mousespeed, mys, camerasmoothness)

LOCAL Fix% = MOD(FtoI(mxs),360) + (mxs - FtoI(mxs))

LOCAL camxa# = 0.0
LOCAL camya# = 0.0

camxa = camxa - Fix
camya = camya + mys

IF camya < -89
camya = -89
ENDIF

IF camya > 89
camya = 89
ENDIF

xMoveMouse(xGraphicsWidth()*0.5, xGraphicsHeight()*0.5)

xRotateEntity(camera, camya, camxa, 0.0)

// turn cube
xTurnEntity(cube, 0, 1, 0)

// render scene
xRenderWorld()

// switch back buffer
xFlip()
WEND

// for camera mouse look
FUNCTION CurveValue#: newValue#, oldValue#, increments%
IF increments% > 1
oldValue# = oldValue# - (oldValue# - newValue#) / increments%
ENDIF
IF increments% <= 1
oldValue# = newValue#
ENDIF
RETURN oldValue#
ENDFUNCTION

// float to integer
FUNCTION FtoI%: input#
LOCAL output% = input#
RETURN output%
ENDFUNCTION

And here is the wrapper code
Code: (glbasic) [Select]
// --------------------------------- //
// Project: xors3d headers
// Start: Monday, September 13, 2010
// IDE Version: 8.085

// AntiAliasing Types
GLOBAL AANONE% = 0
GLOBAL AA2SAMPLES% = 1
GLOBAL AA3SAMPLES% = 2
GLOBAL AA4SAMPLES% = 3
GLOBAL AA5SAMPLES% = 4
GLOBAL AA6SAMPLES% = 5
GLOBAL AA7SAMPLES% = 6
GLOBAL AA8SAMPLES% = 7
GLOBAL AA9SAMPLES% = 8
GLOBAL AA10SAMPLES% = 9
GLOBAL AA11SAMPLES% = 10
GLOBAL AA12SAMPLES% = 11
GLOBAL AA13SAMPLES% = 12
GLOBAL AA14SAMPLES% = 13
GLOBAL AA15SAMPLES% = 14
GLOBAL AA16SAMPLES% = 15

// Texture Loading Flags
GLOBAL FLAGS_COLOR% = 1
GLOBAL FLAGS_ALPHA% = 2
GLOBAL FLAGS_MASKED% = 4
GLOBAL FLAGS_MIPMAPPED% = 8
GLOBAL FLAGS_CLAMPU% = 16
GLOBAL FLAGS_CLAMPV% = 32
GLOBAL FLAGS_SPHERICALENVMAP% = 64
GLOBAL FLAGS_CUBICENVMAP% = 128
GLOBAL FLAGS_R32F% = 256
GLOBAL FLAGS_RESERVED% = 512
GLOBAL FLAGS_VOLUMETEXTURE% = 1024
GLOBAL FLAGS_ARGB16F% = 2048
GLOBAL FLAGS_ARGB32F% = 4096

INLINE
extern "C"
{
// Camera Functions
DECLARE_ALIAS(glb_xCreateCamera, "xors3d.dll", "xCreateCamera", (int, int), int);

// Entity Control Functions
DECLARE_ALIAS(glb_xEntityTexture, "xors3d.dll", "xEntityTexture", (int, int, int, int), void);

// Entity Movement Functions
DECLARE_ALIAS(glb_xPositionEntity, "xors3d.dll", "xPositionEntity", (int, float, float, float, int), void);
DECLARE_ALIAS(glb_xMoveEntity, "xors3d.dll", "xMoveEntity", (int, float, float, float, int), void);
DECLARE_ALIAS(glb_xRotateEntity, "xors3d.dll", "xRotateEntity", (int, float, float, float, int), void);
DECLARE_ALIAS(glb_xTurnEntity, "xors3d.dll", "xTurnEntity", (int, float, float, float, int), void);

// Graphics Functions
DECLARE_ALIAS(glb_xRect, "xors3d.dll", "xRect", (int, int, int, int, int), void);
DECLARE_ALIAS(glb_xGetMaxAntiAlias, "xors3d.dll", "xGetMaxAntiAlias", (), int);
DECLARE_ALIAS(glb_xSetAntiAliasType, "xors3d.dll", "xSetAntiAliasType", (int), void);
DECLARE_ALIAS(glb_xAppTitle, "xors3d.dll", "xAppTitle", (const char*), void);
DECLARE_ALIAS(glb_xSetWND, "xors3d.dll", "xSetWND", (int), void);
DECLARE_ALIAS(glb_xSetRenderWindow, "xors3d.dll", "xSetRenderWindow", (int), void);
DECLARE_ALIAS(glb_xFlip, "xors3d.dll", "xFlip", (), void);
DECLARE_ALIAS(glb_xGraphicsWidth, "xors3d.dll", "xGraphicsWidth", (), int);
DECLARE_ALIAS(glb_xGraphicsHeight, "xors3d.dll", "xGraphicsHeight", (), int);
DECLARE_ALIAS(glb_xRenderWorld, "xors3d.dll", "xRenderWorld", (float, int), void);
DECLARE_ALIAS(glb_xAntiAlias, "xors3d.dll", "xAntiAlias", (int), void);
DECLARE_ALIAS(glb_xHidePointer, "xors3d.dll", "xHidePointer", (), void);
DECLARE_ALIAS(glb_xGraphics3D, "xors3d.dll", "xGraphics3D", (int, int, int, int, int), void);

// Input - Keyboard Functions
DECLARE_ALIAS(glb_xKeyDown, "xors3d.dll", "xKeyDown", (int), int);

// Input - Mouse Functions
DECLARE_ALIAS(glb_xMouseXSpeed, "xors3d.dll", "xMouseXSpeed", (), int);
DECLARE_ALIAS(glb_xMouseYSpeed, "xors3d.dll", "xMouseYSpeed", (), int);
DECLARE_ALIAS(glb_xMoveMouse, "xors3d.dll", "xMoveMouse", (int, int), void);

// Mesh Functions
DECLARE_ALIAS(glb_xCreateCube, "xors3d.dll", "xCreateCube", (int, int), int);

// Texture Functions
DECLARE_ALIAS(glb_xLoadTexture, "xors3d.dll", "xLoadTexture", (const char*, int), int);
}
ENDINLINE

// Camera Functions
FUNCTION xCreateCamera: entity%, parent%=0
INLINE
if(glb_xCreateCamera)
return glb_xCreateCamera(entity, parent);
ENDINLINE
ENDFUNCTION

// Entity Control Functions
FUNCTION xEntityTexture: entity%, texture%, frame%=0, index%=0
INLINE
if(glb_xEntityTexture)
glb_xEntityTexture(entity, texture, frame, index);
ENDINLINE
ENDFUNCTION

// Entity Movement Functions
FUNCTION xPositionEntity: entity%, x#, y#, z#, isGlobal%=FALSE
INLINE
if(glb_xPositionEntity)
glb_xPositionEntity(entity, x, y, z, isGlobal);
ENDINLINE
ENDFUNCTION

FUNCTION xMoveEntity: entity%, x#, y#, z#, isGlobal%=FALSE
INLINE
if(glb_xMoveEntity)
glb_xMoveEntity(entity, x, y, z, isGlobal);
ENDINLINE
ENDFUNCTION

FUNCTION xRotateEntity: entity%, x#, y#, z#, isGlobal%=FALSE
INLINE
if(glb_xRotateEntity)
glb_xRotateEntity(entity, x, y, z, isGlobal);
ENDINLINE
ENDFUNCTION

FUNCTION xTurnEntity: entity%, x#, y#, z#, isGlobal%=FALSE
INLINE
if(glb_xTurnEntity)
glb_xTurnEntity(entity, x, y, z, isGlobal);
ENDINLINE
ENDFUNCTION

// Graphics Functions
FUNCTION xRect: x%, y%, width%, height%, solid%=FALSE
INLINE
if(glb_xRect)
glb_xRect(x, y, width, height, solid);
ENDINLINE
ENDFUNCTION

FUNCTION xGetMaxAntiAlias:
INLINE
if(glb_xGetMaxAntiAlias)
return glb_xGetMaxAntiAlias();
ENDINLINE
ENDFUNCTION

FUNCTION xSetAntiAliasType: typeID%
INLINE
if(glb_xSetAntiAliasType)
glb_xSetAntiAliasType(typeID);
ENDINLINE
ENDFUNCTION

FUNCTION xAppTitle: title$
INLINE
if(glb_xAppTitle)
glb_xAppTitle(title_Str.c_str());
ENDINLINE
ENDFUNCTION

FUNCTION xSetWND: window%
INLINE
if(glb_xSetWND)
glb_xSetWND(window);
ENDINLINE
ENDFUNCTION

FUNCTION xSetRenderWindow: window%
INLINE
if(glb_xSetRenderWindow)
glb_xSetRenderWindow(window);
ENDINLINE
ENDFUNCTION

FUNCTION xFlip:
INLINE
if(glb_xFlip)
glb_xFlip();
ENDINLINE
ENDFUNCTION

FUNCTION xGraphicsWidth:
INLINE
if(glb_xGraphicsWidth)
return glb_xGraphicsWidth();
ENDINLINE
ENDFUNCTION

FUNCTION xGraphicsHeight:
INLINE
if(glb_xGraphicsHeight)
return glb_xGraphicsHeight();
ENDINLINE
ENDFUNCTION

FUNCTION xRenderWorld: twin#=1.0, renderShadows%=FALSE
INLINE
if(glb_xRenderWorld)
glb_xRenderWorld(twin, renderShadows);
ENDINLINE
ENDFUNCTION

FUNCTION xAntiAlias: state%
INLINE
if(glb_xAntiAlias)
glb_xAntiAlias(state);
ENDINLINE
ENDFUNCTION

FUNCTION xHidePointer:
INLINE
if(glb_xHidePointer)
glb_xHidePointer();
ENDINLINE
ENDFUNCTION

FUNCTION xGraphics3D: width%=640, height%=480, depth%=16, mode%=FALSE, vsync%=FALSE
INLINE
if(glb_xGraphics3D)
glb_xGraphics3D(width, height, depth, mode, vsync);
ENDINLINE
ENDFUNCTION

// Input - Keyboard Functions
FUNCTION xKeyDown: key%
INLINE
if(glb_xKeyDown)
return glb_xKeyDown(key);
ENDINLINE
ENDFUNCTION

// Input - Mouse Functions
FUNCTION xMouseXSpeed:
INLINE
if(glb_xMouseXSpeed)
return glb_xMouseXSpeed();
ENDINLINE
ENDFUNCTION

FUNCTION xMouseYSpeed:
INLINE
if(glb_xMouseYSpeed)
return glb_xMouseYSpeed();
ENDINLINE
ENDFUNCTION

FUNCTION xMoveMouse: x%, y%
INLINE
if(glb_xMoveMouse)
glb_xMoveMouse(x, y);
ENDINLINE
ENDFUNCTION

// Mesh Functions
FUNCTION xCreateCube: entity%, parent%=0
INLINE
if(glb_xCreateCube)
return glb_xCreateCube(entity, parent);
ENDINLINE
ENDFUNCTION

// Texture Functions
FUNCTION xLoadTexture: path$, flag%=9
INLINE
if(glb_xLoadTexture)
return glb_xLoadTexture(path_Str.c_str(), flag);
ENDINLINE
ENDFUNCTION

Thanks in advance,
Dave
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9

MrTAToad

  • Guest
How are you loading the DLL ?

Can you make the complete project available ?

Offline aonyn

  • Mr. Polyvector
  • ***
  • Posts: 136
    • View Profile
Hi MrTAToad,

Thanks for the quick reply!  :)

I may be completely misunderstanding, but I think I am loading the DLL implicitly, by naming it as the 2nd argument in the DECLARE_ALIAS call.
The dll is placed in the program (app) directory which is I think the first place it is searched for by order of precedence.

I am attaching the complete project to this post.
It also contains the demo version dll's, as well as the image file used in the sample code.

Thanks,
Dave

[attachment deleted by admin]
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9

MrTAToad

  • Guest
Your DLL  function names are wrong - they need to be either like :

Code: (glbasic) [Select]
DECLARE_ALIAS(glb_xSetAntiAliasType, "xors3d.dll", "_xSetAntiAliasType@4", (int), void);
Or make sure that when the functions are exported, the _x and @number aren't exported.

The complete set of function names are:

Code: (glbasic) [Select]
_xAddMesh@8
_xAddTriangle@16
_xAddVertex@28
_xAlignToVector@24
_xAmbientLight@12
_xAnimLength@8
_xAnimSeq@8
_xAnimSpeed@8
_xAnimTime@8
_xAnimate@24
_xAnimating@8
_xAntiAlias@4
_xAppTitle@4
_xAutoMidHandle@4
_xBackBuffer@0
_xBrushAlpha@8
_xBrushBlend@8
_xBrushColor@16
_xBrushFX@8
_xBrushName@8
_xBrushShininess@8
_xBrushTexture@16
_xBufferDelete@4
_xBufferFloatsGetElement@8
_xBufferFloatsSetElement@12
_xBufferHeight@4
_xBufferMatrixGetElement@8
_xBufferMatrixSetElement@12
_xBufferVectorsGetElement@12
_xBufferVectorsSetElement@24
_xBufferWidth@4
_xCPUFamily@0
_xCPUModel@0
_xCPUName@0
_xCPUSpeed@0
_xCPUStepping@0
_xCPUVendor@0
_xCameraClipPlane@28
_xCameraClsColor@16
_xCameraClsMode@12
_xCameraCropViewport@20
_xCameraDisableShadows@4
_xCameraEnableShadows@4
_xCameraFogColor@16
_xCameraFogMode@8
_xCameraFogRange@12
_xCameraPick@12
_xCameraProjMode@8
_xCameraProject2D@16
_xCameraProject@16
_xCameraRange@12
_xCameraViewport@20
_xCameraZoom@8
_xCaptureWorld@0
_xCatchTimestamp@0
_xChangeDir@4
_xChannelPan@8
_xChannelPitch@8
_xChannelPlaying@4
_xChannelVolume@8
_xCheckMovementGizmo@24
_xCheckRotationGizmo@24
_xCheckScaleGizmo@24
_xClearCollisions@0
_xClearEffectConstants@8
_xClearFXConstants@4
_xClearLogString@0
_xClearPostEffectConstants@4
_xClearSurface@12
_xClearSurfaceConstants@8
_xClearTextureFilters@0
_xClearWorld@12
_xCloseDir@4
_xCloseFile@4
_xCloseMovie@4
_xCls@0
_xClsColor@16
_xCollisionEntity@8
_xCollisionNX@8
_xCollisionNY@8
_xCollisionNZ@8
_xCollisionSurface@8
_xCollisionTime@8
_xCollisionTriangle@8
_xCollisionX@8
_xCollisionY@8
_xCollisionZ@8
_xCollisions@16
_xColor@12
_xColorBlue@0
_xColorGreen@0
_xColorRed@0
_xContactEntity@8
_xCopyEntity@12
_xCopyFile@8
_xCopyImage@4
_xCopyMesh@8
_xCopyPixel@24
_xCopyPixelFast@24
_xCopyRect@32
_xCountChildren@4
_xCountCollisions@4
_xCountContacts@4
_xCountGfxModes@0
_xCountSurfaces@4
_xCountTriangles@4
_xCountVertices@4
_xCreateBrush@12
_xCreateBufferFloats@4
_xCreateBufferMatrix@4
_xCreateBufferVectors@4
_xCreateCamera@4
_xCreateCone@12
_xCreateCube@4
_xCreateCylinder@12
_xCreateDSS@8
_xCreateDir@4
_xCreateEmitter@8
_xCreateImage@12
_xCreateInstance@8
_xCreateJoint@12
_xCreateLight@4
_xCreateListener@16
_xCreateLog@12
_xCreateMesh@4
_xCreatePSystem@4
_xCreatePivot@4
_xCreatePoly@8
_xCreatePostEffectPoly@8
_xCreateSphere@8
_xCreateSprite@4
_xCreateSurface@12
_xCreateTerrain@8
_xCreateTexture@16
_xCreateTextureFromData@20
_xCreateTorus@8
_xCreateWorld@0
_xCurrentDir@0
_xDIPCounter@0
_xDeleteDSS@0
_xDeleteDir@4
_xDeleteEffectConstant@12
_xDeleteFXConstant@8
_xDeleteFile@4
_xDeleteMeshIB@4
_xDeleteMeshVB@4
_xDeletePostEffectConstant@8
_xDeleteSurfaceConstant@12
_xDeleteWorld@4
_xDeltaPitch@8
_xDeltaYaw@8
_xDither@4
_xDrawBBox@24
_xDrawBlock@16
_xDrawBlockRect@32
_xDrawGrid@16
_xDrawImage@16
_xDrawImageRect@32
_xDrawMovementGizmo@16
_xDrawMovie@20
_xDrawRotationGizmo@28
_xDrawScaleGizmo@28
_xEmitSound@8
_xEmitterAddParticle@4
_xEmitterCountParticles@4
_xEmitterEnable@8
_xEmitterEnabled@4
_xEmitterFreeParticle@8
_xEmitterGetPSystem@4
_xEmitterGetParticle@8
_xEmitterValidateParticle@8
_xEntityAddBoxShape@20
_xEntityAddCapsuleShape@16
_xEntityAddConeShape@16
_xEntityAddCylinderShape@20
_xEntityAddDummyShape@4
_xEntityAddHullShape@8
_xEntityAddSphereShape@12
_xEntityAddTriMeshShape@8
_xEntityAlpha@8
_xEntityAmbientColor@16
_xEntityAngularFactor@16
_xEntityAngularFactorX@4
_xEntityAngularFactorY@4
_xEntityAngularFactorZ@4
_xEntityApplyCentralForce@16
_xEntityApplyCentralImpulse@16
_xEntityApplyForce@28
_xEntityApplyImpulse@28
_xEntityApplyTorque@16
_xEntityApplyTorqueImpulse@16
_xEntityAutoFade@12
_xEntityBlend@8
_xEntityBlue@4
_xEntityBox@28
_xEntityCastShadows@12
_xEntityClass@4
_xEntityCollided@8
_xEntityColor@16
_xEntityContactDistance@8
_xEntityContactNX@8
_xEntityContactNY@8
_xEntityContactNZ@8
_xEntityContactX@8
_xEntityContactY@8
_xEntityContactZ@8
_xEntityDamping@12
_xEntityDistance@8
_xEntityEmissiveColor@16
_xEntityFX@8
_xEntityForceX@4
_xEntityForceY@4
_xEntityForceZ@4
_xEntityFriction@8
_xEntityGravity@16
_xEntityGravityX@4
_xEntityGravityY@4
_xEntityGravityZ@4
_xEntityGreen@4
_xEntityInView@8
_xEntityIsCaster@8
_xEntityIsReceiver@8
_xEntityLinearFactor@16
_xEntityLinearFactorX@4
_xEntityLinearFactorY@4
_xEntityLinearFactorZ@4
_xEntityName@4
_xEntityOrder@8
_xEntityParent@12
_xEntityPick@8
_xEntityPickMode@16
_xEntityPitch@8
_xEntityQuaternion@20
_xEntityRadius@12
_xEntityReceiveShadows@12
_xEntityRed@4
_xEntityReleaseForces@4
_xEntityRendered@0
_xEntityRoll@8
_xEntityScaleX@4
_xEntityScaleY@4
_xEntityScaleZ@4
_xEntityShininess@8
_xEntitySpecularColor@16
_xEntityTexture@16
_xEntityTorqueX@4
_xEntityTorqueY@4
_xEntityTorqueZ@4
_xEntityType@12
_xEntityVisible@8
_xEntityX@8
_xEntityY@8
_xEntityYaw@8
_xEntityZ@8
_xEof@4
_xExtractAnimSeq@16
_xFilePos@4
_xFileSize@4
_xFileType@4
_xFindChild@8
_xFindSurface@8
_xFitMesh@32
_xFlip@0
_xFlipMesh@4
_xFlushJoy@0
_xFlushKeys@0
_xFlushMouse@0
_xFontHeight@0
_xFontWidth@0
_xFreeBrush@4
_xFreeEffect@4
_xFreeEntity@4
_xFreeEntityShapes@4
_xFreeFont@4
_xFreeImage@4
_xFreeJoint@4
_xFreePSystem@4
_xFreePostEffect@4
_xFreeSound@4
_xFreeSurface@4
_xFreeTexture@4
_xFreezeInstances@8
_xGetActiveWorld@0
_xGetAlphaFunc@4
_xGetAlphaRef@4
_xGetAvailPageMem@0
_xGetAvailPhysMem@0
_xGetAvailVidLocalMem@0
_xGetAvailVidMem@0
_xGetAvailVidNonlocalMem@0
_xGetBrushAlpha@4
_xGetBrushBlend@4
_xGetBrushBlue@4
_xGetBrushFX@4
_xGetBrushGreen@4
_xGetBrushName@4
_xGetBrushRed@4
_xGetBrushShininess@4
_xGetBrushTexture@8
_xGetChild@8
_xGetColor@8
_xGetCurrentBuffer@0
_xGetDefaultWorld@0
_xGetDevice@0
_xGetElapsedTime@4
_xGetEngineSetting@4
_xGetEntityAlpha@4
_xGetEntityAngularDamping@4
_xGetEntityBlend@4
_xGetEntityBrush@4
_xGetEntityFX@4
_xGetEntityFriction@4
_xGetEntityLinearDamping@4
_xGetEntityMatrix@4
_xGetEntityShaderLayer@4
_xGetEntityShininess@4
_xGetEntityType@4
_xGetFPS@0
_xGetFunctionAddress@4
_xGetJoy@4
_xGetKey@0
_xGetListener@0
_xGetLogLevel@0
_xGetLogString@0
_xGetLogTarget@0
_xGetMatElement@12
_xGetMaxAntiAlias@0
_xGetMaxPixelShaderVersion@0
_xGetMaxVertexShaderVersion@0
_xGetMeshIB@4
_xGetMeshIBSize@4
_xGetMeshVB@4
_xGetMeshVBSize@4
_xGetMouse@0
_xGetNumberRT@0
_xGetParent@4
_xGetPixels@4
_xGetProjectionMatrix@4
_xGetRenderWindow@0
_xGetShaderLayer@0
_xGetSurface@8
_xGetSurfaceBrush@4
_xGetSurfaceShaderLayer@4
_xGetSurfaceTexture@8
_xGetTextureData@8
_xGetTextureDataPitch@8
_xGetTextureFrames@4
_xGetTextureSurface@8
_xGetTotalPageMem@0
_xGetTotalPhysMem@0
_xGetTotalVidLocalMem@0
_xGetTotalVidMem@0
_xGetTotalVidNonlocalMem@0
_xGetViewMatrix@4
_xGfxModeDepth@4
_xGfxModeExists@12
_xGfxModeHeight@4
_xGfxModeWidth@4
_xGrabImage@16
_xGraphics3D@20
_xGraphicsBuffer@0
_xGraphicsDepth@0
_xGraphicsHeight@0
_xGraphicsWidth@0
_xHWInstancingAvailable@0
_xHandleImage@12
_xHandleSprite@12
_xHideEntity@4
_xHidePointer@0
_xImageAlpha@8
_xImageBuffer@8
_xImageColor@16
_xImageHeight@4
_xImageRectCollide@32
_xImageRectOverlap@28
_xImageWidth@4
_xImageXHandle@4
_xImageYHandle@4
_xImagesCollide@32
_xImagesOverlap@24
_xInitShadows@12
_xInstancingAvaliable@0
_xJoint6dofSpringParam@20
_xJointAngularLimits@28
_xJointAngularLowerX@4
_xJointAngularLowerY@4
_xJointAngularLowerZ@4
_xJointAngularUpperX@4
_xJointAngularUpperY@4
_xJointAngularUpperZ@4
_xJointEnableMotor@20
_xJointHingeAxis@16
_xJointHingeLimit@24
_xJointHingeLowerLimit@4
_xJointHingeMotorTarget@12
_xJointHingeUpperLimit@4
_xJointLinearLimits@28
_xJointLinearLowerX@4
_xJointLinearLowerY@4
_xJointLinearLowerZ@4
_xJointLinearUpperX@4
_xJointLinearUpperY@4
_xJointLinearUpperZ@4
_xJointPivotA@16
_xJointPivotAX@4
_xJointPivotAY@4
_xJointPivotAZ@4
_xJointPivotB@16
_xJointPivotBX@4
_xJointPivotBY@4
_xJointPivotBZ@4
_xJoyDown@8
_xJoyHat@4
_xJoyHit@8
_xJoyPitch@4
_xJoyRoll@4
_xJoyType@4
_xJoyU@4
_xJoyUDir@4
_xJoyV@4
_xJoyVDir@4
_xJoyX@4
_xJoyXDir@4
_xJoyY@4
_xJoyYDir@4
_xJoyYaw@4
_xJoyZ@4
_xJoyZDir@4
_xKey@4
_xKeyDown@4
_xKeyHit@4
_xKeyUp@4
_xLightColor@16
_xLightConeAngles@12
_xLightEnableShadows@8
_xLightRange@8
_xLightShadowEpsilons@12
_xLightShadowsEnabled@4
_xLine@16
_xLinePick@28
_xLoad3DSound@4
_xLoadAnimImage@20
_xLoadAnimMesh@8
_xLoadAnimSeq@8
_xLoadAnimTexture@24
_xLoadBrush@16
_xLoadBuffer@8
_xLoadFXFile@4
_xLoadFont@20
_xLoadImage@4
_xLoadMesh@8
_xLoadMeshWithChild@8
_xLoadPostEffect@4
_xLoadSound@4
_xLoadSprite@12
_xLoadTerrain@8
_xLoadTexture@8
_xLockBuffer@4
_xLogError@4
_xLogFatal@4
_xLogInfo@4
_xLogMessage@4
_xLogWarning@4
_xLoopSound@4
_xLostDevice@0
_xMaskImage@16
_xMaxClipPlanes@0
_xMeshDepth@8
_xMeshHeight@8
_xMeshSingleSurface@4
_xMeshWidth@8
_xMeshesBBIntersect@8
_xMeshesIntersect@8
_xMidHandle@4
_xModifyTerrain@20
_xMountPackFile@12
_xMouseDown@4
_xMouseHit@4
_xMouseUp@4
_xMouseX@0
_xMouseXSpeed@0
_xMouseY@0
_xMouseYSpeed@0
_xMouseZ@0
_xMouseZSpeed@0
_xMoveEntity@20
_xMoveMouse@8
_xMovieCurrentTime@4
_xMovieHeight@4
_xMovieLength@4
_xMoviePause@4
_xMoviePlaying@4
_xMovieResume@4
_xMovieSeek@12
_xMovieTexture@4
_xMovieWidth@4
_xNameEntity@8
_xNextFile@4
_xOpenFile@4
_xOpenMovie@4
_xOrigin@8
_xOval@20
_xPSystemEnableFixedQuads@8
_xPSystemFixedQuadsUsed@4
_xPSystemGetAlpha@4
_xPSystemGetAnglesMaxX@4
_xPSystemGetAnglesMaxY@4
_xPSystemGetAnglesMaxZ@4
_xPSystemGetAnglesMinX@4
_xPSystemGetAnglesMinY@4
_xPSystemGetAnglesMinZ@4
_xPSystemGetBeginColorBlue@4
_xPSystemGetBeginColorGreen@4
_xPSystemGetBeginColorRed@4
_xPSystemGetBlend@4
_xPSystemGetColorMode@4
_xPSystemGetCreationFrequency@4
_xPSystemGetCreationInterval@4
_xPSystemGetEmitterLifetime@4
_xPSystemGetEndColorBlue@4
_xPSystemGetEndColorGreen@4
_xPSystemGetEndColorRed@4
_xPSystemGetFadeSpeed@4
_xPSystemGetGravity@4
_xPSystemGetMaxParticles@4
_xPSystemGetOffsetMaxX@4
_xPSystemGetOffsetMaxY@4
_xPSystemGetOffsetMaxZ@4
_xPSystemGetOffsetMinX@4
_xPSystemGetOffsetMinY@4
_xPSystemGetOffsetMinZ@4
_xPSystemGetParticleLifetime@4
_xPSystemGetScaleSpeedMaxX@4
_xPSystemGetScaleSpeedMaxY@4
_xPSystemGetScaleSpeedMinX@4
_xPSystemGetScaleSpeedMinY@4
_xPSystemGetSizeMaxX@4
_xPSystemGetSizeMaxY@4
_xPSystemGetSizeMinX@4
_xPSystemGetSizeMinY@4
_xPSystemGetTexture@4
_xPSystemGetTextureAnimationSpeed@4
_xPSystemGetTextureFrames@4
_xPSystemGetTorqueMaxX@4
_xPSystemGetTorqueMaxY@4
_xPSystemGetTorqueMaxZ@4
_xPSystemGetTorqueMinX@4
_xPSystemGetTorqueMinY@4
_xPSystemGetTorqueMinZ@4
_xPSystemGetVelocityMaxX@4
_xPSystemGetVelocityMaxY@4
_xPSystemGetVelocityMaxZ@4
_xPSystemGetVelocityMinX@4
_xPSystemGetVelocityMinY@4
_xPSystemGetVelocityMinZ@4
_xPSystemSetAlpha@8
_xPSystemSetAngles@28
_xPSystemSetBlend@8
_xPSystemSetColorMode@8
_xPSystemSetColors@28
_xPSystemSetCreationFrequency@8
_xPSystemSetCreationInterval@8
_xPSystemSetEmitterLifetime@8
_xPSystemSetFadeSpeed@8
_xPSystemSetGravity@8
_xPSystemSetMaxParticles@8
_xPSystemSetOffset@28
_xPSystemSetParticleLifetime@8
_xPSystemSetParticleSize@20
_xPSystemSetScaleSpeed@20
_xPSystemSetTexture@16
_xPSystemSetTorque@28
_xPSystemSetVelocity@28
_xPSystemType@4
_xPaintEntity@8
_xPaintMesh@8
_xPaintSurface@8
_xParticleBlue@4
_xParticleColor@16
_xParticleGetAlpha@4
_xParticleGreen@4
_xParticlePitch@4
_xParticlePosition@16
_xParticleRed@4
_xParticleRoll@4
_xParticleRotation@16
_xParticleSX@4
_xParticleSY@4
_xParticleScale@12
_xParticleScaleSpeed@12
_xParticleScaleSpeedX@4
_xParticleScaleSpeedY@4
_xParticleSetAlpha@8
_xParticleTPitch@4
_xParticleTRoll@4
_xParticleTYaw@4
_xParticleTorque@16
_xParticleVX@4
_xParticleVY@4
_xParticleVZ@4
_xParticleVeclocity@16
_xParticleX@4
_xParticleY@4
_xParticleYaw@4
_xParticleZ@4
_xPauseChannel@4
_xPickedEntity@0
_xPickedNX@0
_xPickedNY@0
_xPickedNZ@0
_xPickedSurface@0
_xPickedTime@0
_xPickedTriangle@0
_xPickedX@0
_xPickedY@0
_xPickedZ@0
_xPlayMusic@4
_xPlaySound@4
_xPointEntity@12
_xPositionEntity@20
_xPositionMesh@16
_xPositionTexture@12
_xProjectedX@0
_xProjectedY@0
_xProjectedZ@0
_xReadByte@4
_xReadDir@4
_xReadFile@4
_xReadFloat@4
_xReadInt@4
_xReadLine@4
_xReadPixel@12
_xReadPixelFast@12
_xReadShort@4
_xReadString@4
_xRect@20
_xReleaseXors@0
_xRenderEntity@8
_xRenderPostEffect@4
_xRenderPostEffects@0
_xRenderShadows@8
_xRenderWorld@8
_xResetEntity@4
_xResizeImage@12
_xResumeChannel@4
_xRotateEntity@20
_xRotateImage@8
_xRotateMesh@16
_xRotateSprite@8
_xRotateTexture@8
_xSaveBuffer@8
_xSaveImage@12
_xSaveMesh@8
_xScaleEntity@20
_xScaleImage@12
_xScaleMesh@16
_xScaleSprite@12
_xScaleTexture@12
_xSeekFile@8
_xSetActiveWorld@4
_xSetAlphaFunc@8
_xSetAlphaRef@8
_xSetAnimFrame@16
_xSetAnimSpeed@12
_xSetAnimTime@16
_xSetAntiAliasType@4
_xSetAutoTB@4
_xSetBonesArrayName@12
_xSetBuffer@4
_xSetCubeFace@8
_xSetCubeMode@8
_xSetEffectBool@16
_xSetEffectEntityMatrix@16
_xSetEffectEntityTexture@16
_xSetEffectFloat@16
_xSetEffectFloatArray@20
_xSetEffectInt@16
_xSetEffectIntArray@20
_xSetEffectMatrix@76
_xSetEffectMatrixArray@20
_xSetEffectMatrixSemantic@16
_xSetEffectTechnique@12
_xSetEffectTexture@20
_xSetEffectVector@28
_xSetEffectVectorArray@20
_xSetEngineSetting@8
_xSetEntityEffect@12
_xSetEntityMatrix@8
_xSetEntityQuaternion@8
_xSetEntityShaderLayer@8
_xSetFXBool@12
_xSetFXEntityMatrix@12
_xSetFXFloat@12
_xSetFXFloatArray@16
_xSetFXInt@12
_xSetFXIntArray@16
_xSetFXMatrixArray@16
_xSetFXMatrixSemantic@12
_xSetFXTechnique@8
_xSetFXTexture@16
_xSetFXVector@24
_xSetFXVectorArray@16
_xSetFont@4
_xSetFrustumSphere@20
_xSetLogLevel@4
_xSetLogTarget@4
_xSetMRT2@12
_xSetMRT@12
_xSetPostEffect@12
_xSetPostEffectBool@12
_xSetPostEffectFloat@12
_xSetPostEffectInt@12
_xSetPostEffectTexture@16
_xSetPostEffectVector@24
_xSetRenderWindow@4
_xSetShaderLayer@4
_xSetShadowParams@16
_xSetShadowShader@4
_xSetSkinningMethod@4
_xSetSurfaceEffect@12
_xSetSurfaceFrustumSphere@20
_xSetSurfaceShaderLayer@8
_xSetTextureFilter@8
_xSetTextureFiltering@4
_xSetWND@4
_xShaderInstancingAvailable@0
_xShadowPriority@4
_xShowEntity@4
_xShowPointer@0
_xSoundPan@8
_xSoundPitch@8
_xSoundVolume@8
_xSphereInFrustum@20
_xSpriteViewMode@8
_xStopChannel@4
_xStretchBackBuffer@24
_xStretchRect@44
_xStringHeight@4
_xStringWidth@4
_xSurfRendered@0
_xSurfaceBonesArrayName@12
_xSurfaceEffectBool@16
_xSurfaceEffectEntityMatrix@16
_xSurfaceEffectEntityTexture@16
_xSurfaceEffectFloat@16
_xSurfaceEffectFloatArray@20
_xSurfaceEffectInt@16
_xSurfaceEffectIntArray@20
_xSurfaceEffectMatrix@76
_xSurfaceEffectMatrixArray@20
_xSurfaceEffectMatrixSemantic@16
_xSurfaceEffectTexture@20
_xSurfaceEffectVector@28
_xSurfaceEffectVectorArray@20
_xSurfaceTechnique@12
_xTFormNormal@20
_xTFormPoint@20
_xTFormVector@20
_xTFormedX@0
_xTFormedY@0
_xTFormedZ@0
_xTerrainDetail@8
_xTerrainHeight@12
_xTerrainShading@8
_xTerrainSize@4
_xTerrainSplatting@8
_xTerrainX@16
_xTerrainY@16
_xTerrainZ@16
_xText@20
_xTextureBlend@8
_xTextureBuffer@8
_xTextureCoords@8
_xTextureFilter@8
_xTextureHeight@4
_xTextureName@4
_xTextureWidth@4
_xTileImage@16
_xTranslateEntity@20
_xTriangleVertex@12
_xTrisRendered@0
_xTurnEntity@20
_xUnSetMRT@0
_xUnlockBuffer@4
_xUnmountPackFile@4
_xUpdateN@4
_xUpdateNormals@4
_xUpdateTB@4
_xUpdateWorld@4
_xValidateEffectTechnique@8
_xVectorPitch@12
_xVectorYaw@12
_xVertexAlpha@8
_xVertexBX@8
_xVertexBY@8
_xVertexBZ@8
_xVertexBinormal@20
_xVertexBlue@8
_xVertexColor@24
_xVertexCoords@20
_xVertexGreen@8
_xVertexNX@8
_xVertexNY@8
_xVertexNZ@8
_xVertexNormal@20
_xVertexRed@8
_xVertexTX@8
_xVertexTY@8
_xVertexTZ@8
_xVertexTangent@20
_xVertexTexCoords@24
_xVertexU@12
_xVertexV@12
_xVertexX@8
_xVertexY@8
_xVertexZ@8
_xVideoInfo@0
_xViewport@16
_xWaitJoy@4
_xWaitKey@0
_xWinMessage@4
_xWireframe@4
_xWorldFrequency@8
_xWorldGravity@16
_xWorldGravityX@4
_xWorldGravityY@4
_xWorldGravityZ@4
_xWriteByte@8
_xWriteFile@4
_xWriteFloat@8
_xWriteInt@8
_xWriteLine@8
_xWritePixel@16
_xWritePixelFast@16
_xWriteShort@8
_xWriteString@8

Offline aonyn

  • Mr. Polyvector
  • ***
  • Posts: 136
    • View Profile
Thank you very much MrTAToad.

I was getting the function names from the html documentation which came with the dll.
In there, the extra characters were not included.

After seeing your explanation, I just dug into the dll with dependency walker, and lo and behold, you are correct.
I don't fully understand why the function names are different than the documented function names, but I guess sometimes it is important to just accept the magic.

Also how dumb do I feel now  :S but I guess it takes trying and making dumb mistakes to learn.  :)

Thank you for your very useful feedback.

regards,
Dave
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9

Offline aonyn

  • Mr. Polyvector
  • ***
  • Posts: 136
    • View Profile
Hi MrTAToad,

Thanks, your advice did help, and the dll seems to be mostly working.
Although I do have a lingering problem, well a couple, but one specific to the dll (I think the other I need to rethink something I translated from PB in the sample code)

The problem I am concerned with is any function from the dll which currently takes a const char*.
These functions are not working correctly, and are corrupting the strings I pass.

I checked the .h files provided with the dll for use with C++, and they are using charsArray instead of const char*, in xorsbind.h, and they are using const char * in xors3d.h (note the space before the pointer - not sure if that is significant).
GLBasic INLINE does not seem to even recognize charsArray.
Does anyone know what I can do to pass strings to charsArray, or is there something I can do to make a const char* pass in a compatible format for a charsArray?

regards,
Dave
« Last Edit: 2010-Sep-15 by aonyn »
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9

MrTAToad

  • Guest
Unfortunately I dont know what charsArray is defined as.  If its a template or perhaps a class, you could do something like :

Code: (glbasic) [Select]
charsArray something = charsArray("test")
It sounds like something else needs to be #include'd

Offline aonyn

  • Mr. Polyvector
  • ***
  • Posts: 136
    • View Profile
Hi MrTAToad,

Thanks again, I am hoping your comment about something else needs to be included may be the key.
I am wondering if perhaps a better approach may be to take another approach, and use the c++ headers and libraries which were included in the demo using inline c++, then import the functions to glbasic.
Unfortunately, I am not sure exactly how this is done, but I will begin looking through sample code from the forum to see if I can find an example, or if you have any advice how to try this, of course any help is appreciated.

regards,
Dave
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9

MrTAToad

  • Guest
You would probably have trouble trying to #include all the xors3d headers in GLBasic as no doubt they would want stuff like stdio.h etc etc

So making a C DLL of xors3d for use with GLBasic would be best, especially if you put an interface system for converting to and from chars and charsArray

Offline aonyn

  • Mr. Polyvector
  • ***
  • Posts: 136
    • View Profile
OK, thanks for the tip MrTAToad,

That at least gives me a starting point to begin looking at.

Regards,
Dave
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9

Offline aonyn

  • Mr. Polyvector
  • ***
  • Posts: 136
    • View Profile
Hi All,

I just started to make a wrapper for Blitz3d SDK, not because I want it wrapped for GLBasic, but rather just to see if I have success with that engine dll, using the method I am already using.
It works perfectly, no trouble at all. Even strings are passed properly to const char* parameters.

Anyway, this definately confirms to me, something is being done differently in the xors3d engine with const char* types (as I already suspected based on seeing some reference to charsArray.
I will investigate further, and post back if/when I figure out the solution.

regards,
Dave
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9

Offline aonyn

  • Mr. Polyvector
  • ***
  • Posts: 136
    • View Profile
Hi Ocean,

No, I had not.
This is entirely new ground for me.

Thank you for the tip, that certainly makes sense as a possibility.
I will investigate that as well, and of course will post back.

regards,
Dave
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9

Offline aonyn

  • Mr. Polyvector
  • ***
  • Posts: 136
    • View Profile
I am not positive whether the dll is unicode or ascii yet.
I searched the forum here and it appears that glbasic is simply does not support unicode.

In the purebasic documentation, it appears I can easily do a conversion using the built in ReadString and WriteString commands, with the appropriate flags.
So, I am thinking of writing a set of procedures to handle it in purebasic, compile it as a dll, and wrap that as well and call my own function from that dll as necessary.
I have never created a dll with purebasic, but I know it has the capability, and think this may be the easiest way for me to handle this.

If someone has a better approach I can try, I would of course love to hear any suggestions.

Thanks again everyone for your help.

regards,
Dave
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10851
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
If you want to convert unicode, just assume it's a string, where every other character is a 0.
Like:

glbasic (ascii)
g0l0b0a0s0i0c (unicode)

the "0" are 0 bytes, where the "g" are ascii character (72 or whatever).
So, to make your string unicode, just append the "\0" characters. To make it from unicode just cut them out. You can do that with simple GLBasic comamnds. GLBasic strings _can_ contain '\0' characters.

Offline aonyn

  • Mr. Polyvector
  • ***
  • Posts: 136
    • View Profile
Thanks Kitty Hello,

I will try that and post back here to say whether it was the solution or not.

regards,
Dave
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9