Results 1 to 8 of 8

Thread: Wrapping DLL functions bug

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Jan 2010
    Age
    35
    Posts
    12
    Rep Power
    16

    Question Wrapping DLL functions bug

    I started to wrap Xors3D Engine for my projects and there were some problems.

    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 tHandle
    
    My 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).

    screenshot.png

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

    http://dark5132007.narod.ru/wrapper.rar
    Last edited by Bagamut; 09-01-2011 at 14:52.

Similar Threads

  1. Maxim: Use of SDK for wrapping the Irrlicht
    By maxim in forum thinBasic SDK
    Replies: 12
    Last Post: 08-07-2011, 18:22
  2. Inner Functions
    By Charles Pegge in forum O2h Compiler
    Replies: 3
    Last Post: 12-07-2009, 23:51

Members who have read this thread: 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •