Results 1 to 8 of 8

Thread: Wrapping DLL functions bug

  1. #1

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

    Click image for larger version. 

Name:	screenshot.png 
Views:	176 
Size:	33.4 KB 
ID:	7034

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

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

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,083
    Blog Entries
    5
    Rep Power
    725
    Hi Bagamut!

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


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,083
    Blog Entries
    5
    Rep Power
    725
    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
    Attached Files Attached Files
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  4. #4
    Quote Originally Posted by Petr Schreiber View Post
    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?

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10
    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.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  6. #6
    Member
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    406
    Rep Power
    53
    Hi,

    there is a bug in the xors3D.dll!

    Peter
    Attached Files Attached Files

  7. #7
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10
    Petr,

    can you give more details?

    Thanks a lot
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  8. #8
    Member
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    406
    Rep Power
    53
    sorry Eros, I took the wrong 'xors3D.dll'.
    runs on windows 64 without any problems with thinBasic.

    Peter

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

Posting Permissions

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