PDA

View Full Version : Wrapping DLL functions bug



Bagamut
09-01-2011, 14:39
I started to wrap Xors3D Engine for my projects and there were some problems.:confused:

Some info about xors3d.dll: all functions using stdcall calling convention.

My wrappers code (xors3d.inc):

Alias Long As tHandle

' Test Function for Working
Declare Sub xGraphics3D Lib "xors3d.dll" Alias "_xGraphics3D@20" (_
ByVal scr_width As Long,_
ByVal scr_height As Long,_
ByVal scr_depth As Long,_
ByVal scr_mode As Long,_
ByVal scr_vsync As Long)
Declare Sub xAppTitle Lib "xors3d.dll" Alias "_xAppTitle@4" (ByVal title As Asciiz)
Declare Sub xSetBuffer Lib "xors3d.dll" Alias "_xSetBuffer@4" (ByVal buffer As tHandle)
Declare Function xBackBuffer Lib "xors3d.dll" Alias "_xBackBuffer@0" () As tHandle
Declare Sub xFlip Lib "xors3d.dll" Alias "_xFlip@0" ()
Declare Function xKeyHit Lib "xors3d.dll" Alias "_xKeyHit@4" (ByVal key As Long) As Long
Declare Function xWinMessage Lib "xors3d.dll" Alias "_xWinMessage@4" (ByVal message As Asciiz) As Long
Declare Sub xReleaseGraphics Lib "xors3d.dll" Alias "_xReleaseGraphics@0" ()

' Brushes commands
Declare Function xLoadBrush Lib "xors3d.dll" Alias "_xLoadBrush@16" (_
ByVal path As Asciiz,_
ByVal flags As Long,_
ByVal xScale As Single,_
ByVal yScale As Single) As tHandleMy project code example (test_wrapper.tbasic):

#INCLUDE "%APP_INCLUDEPATH%\xors3d.inc"

xAppTitle("Тестируем Xors3D")
xGraphics3D(800, 600, 32, 0, 1)

xSetBuffer(xBackBuffer())

While xKeyHit(%xKEY_ESCAPE) = 0
xFlip()
If xWinMessage("WM_CLOSE") Then Exit While
Wend
xReleaseGraphics()
End

When I trying execute script, i have bug (see atachments).

7034

Wrapper files (*.tbasic, *.inc, *.dll):

http://dark5132007.narod.ru/wrapper.rar

Petr Schreiber
09-01-2011, 15:02
Hi Bagamut!

I can confirm the problem, looking into it, stay tuned.


Petr

Petr Schreiber
09-01-2011, 15:20
Hi,

I am not sure what is going wrong here, I managed to run it in the end, but it tends to crash if I put the PrintLn out... Could be some "odd characters" problem, I am not sure.


Petr

Bagamut
09-01-2011, 15:59
Hi,

I am not sure what is going wrong here, I managed to run it in the end, but it tends to crash if I put the PrintLn out... Could be some "odd characters" problem, I am not sure.


Petr

Maybe it's thinbasic bug?

ErosOlmi
09-01-2011, 16:04
I'm sorry I cannot test because I'm under a 64bit environment and xors3D seems using 64 bit versions of some OS lib and some 32 version of Directx lib that I do not have.

I'm setting up a32 bit virtual machine in order to test it.
Regarding source code it seems it has sequence of A0 chars (check with an HEX editor) that (at the moment) must be removed. I will see if I can add managing of this in parser for future thinBasic versions.

peter
09-01-2011, 17:51
Hi,

there is a bug in the xors3D.dll!

Peter

ErosOlmi
09-01-2011, 22:15
Petr,

can you give more details?

Thanks a lot
Eros

peter
09-01-2011, 22:37
sorry Eros, I took the wrong 'xors3D.dll'.
runs on windows 64 without any problems with thinBasic.

Peter