Need Help to wrap Xors3d.dll
Need Help to wrap Xors3d.dll
Hello Everybody!
A few days ago i start wrapping Xors3D engine. Cause i don't have much experience in programming in FreeBasic i have some problems with it. I have 2 versions of wrapper: 1st - with *.bas file (my old version, using DylibSymbol() functions); 2nd - with *.bi file (using declare).
First version of my wrapper working fine, but i think it's not good choice to wrap functions. With Second version i have some problems - the my_example.bas successfully compiled, but then window open i have a error.
If someone can help me plz reply.
Here a wrappers!
A few days ago i start wrapping Xors3D engine. Cause i don't have much experience in programming in FreeBasic i have some problems with it. I have 2 versions of wrapper: 1st - with *.bas file (my old version, using DylibSymbol() functions); 2nd - with *.bi file (using declare).
First version of my wrapper working fine, but i think it's not good choice to wrap functions. With Second version i have some problems - the my_example.bas successfully compiled, but then window open i have a error.
If someone can help me plz reply.
Here a wrappers!
I noticed some things in your code:
1. Are you sure the DLL uses C Decl? From the aliases it seems that they use Stdcall (it has @n in the end), so you don't need them.
to:
2. Where's libxors3d.dll.a/libxors3d.a ? You need this file when linking using #inclib's. If you don't have one, I'll tell you how.
1. Are you sure the DLL uses C Decl? From the aliases it seems that they use Stdcall (it has @n in the end), so you don't need them.
Code: Select all
' ...
Extern "c"
' ...
Declare Function xGraphics3D Alias "_xGraphics3D@20" (_
ByVal scr_width As Integer = 640,_
ByVal scr_height As Integer = 480,_
ByVal scr_depth As Integer = 16,_
ByVal scr_mode As Integer = 0,_
ByVal scr_vsync As Integer = 0) As Integer
' ...
End Extern
' ...
Code: Select all
' ...
Declare Function xGraphics3D (_
ByVal scr_width As Integer = 640,_
ByVal scr_height As Integer = 480,_
ByVal scr_depth As Integer = 16,_
ByVal scr_mode As Integer = 0,_
ByVal scr_vsync As Integer = 0) As Integer
' ...
No I'm not sure, but when i delete "Extern "c" / End Extern" debuger output:Galeon wrote:I noticed some things in your code:
1. Are you sure the DLL uses C Decl? From the aliases it seems that they use Stdcall (it has @n in the end), so you don't need them.
to:Code: Select all
' ... Extern "c" ' ... Declare Function xGraphics3D Alias "_xGraphics3D@20" (_ ByVal scr_width As Integer = 640,_ ByVal scr_height As Integer = 480,_ ByVal scr_depth As Integer = 16,_ ByVal scr_mode As Integer = 0,_ ByVal scr_vsync As Integer = 0) As Integer ' ... End Extern ' ...
Code: Select all
' ... Declare Function xGraphics3D (_ ByVal scr_width As Integer = 640,_ ByVal scr_height As Integer = 480,_ ByVal scr_depth As Integer = 16,_ ByVal scr_mode As Integer = 0,_ ByVal scr_vsync As Integer = 0) As Integer ' ...
Code: Select all
D:\Program Files\FreeBASIC\fbc -s gui "test_xors_bi.bas"
test_xors_bi.o:fake:(.text+0x28): undefined reference to `_xAppTitle@4@4'
test_xors_bi.o:fake:(.text+0x3d): undefined reference to `_xGraphics3D@20@20'
test_xors_bi.o:fake:(.text+0x42): undefined reference to `_xBackBuffer@0@0'
test_xors_bi.o:fake:(.text+0x48): undefined reference to `_xSetBuffer@4@4'
test_xors_bi.o:fake:(.text+0x4f): undefined reference to `_xCreateCube@4@4'
test_xors_bi.o:fake:(.text+0x6e): undefined reference to `_xScaleEntity@20@20'
test_xors_bi.o:fake:(.text+0x8a): undefined reference to `_xPositionEntity@20@20'
test_xors_bi.o:fake:(.text+0x9b): undefined reference to `_xEntityColor@16@16'
test_xors_bi.o:fake:(.text+0xa5): undefined reference to `_xEntityFX@8@8'
test_xors_bi.o:fake:(.text+0xac): undefined reference to `_xCreateCamera@4@4'
test_xors_bi.o:fake:(.text+0xc5): undefined reference to `_xCameraViewport@20@20'
test_xors_bi.o:fake:(.text+0xdc): undefined reference to `_xCameraClsColor@16@16'
test_xors_bi.o:fake:(.text+0xe8): undefined reference to `_xCameraClsMode@12@12'
test_xors_bi.o:fake:(.text+0x104): undefined reference to `_xPositionEntity@20@20'
test_xors_bi.o:fake:(.text+0x10b): undefined reference to `_xCreateLight@4@4'
test_xors_bi.o:fake:(.text+0x12a): undefined reference to `_xPositionEntity@20@20'
test_xors_bi.o:fake:(.text+0x131): undefined reference to `_xKeyHit@4@4'
test_xors_bi.o:fake:(.text+0x151): undefined reference to `_xTurnEntity@20@20'
test_xors_bi.o:fake:(.text+0x15c): undefined reference to `_xUpdateWorld@4@4'
test_xors_bi.o:fake:(.text+0x169): undefined reference to `_xRenderWorld@8@8'
test_xors_bi.o:fake:(.text+0x16e): undefined reference to `_xFlip@0@0'
No, I don't have "libxors3d.dll.a / libxors3d.a" libs and i don't know how to create it.Galeon wrote:2. Where's libxors3d.dll.a/libxors3d.a ? You need this file when linking using #inclib's. If you don't have one, I'll tell you how.
Wait, I'm uploading it now
Edit: Here it is with all the files. I edited the *.bi file.
http://wargaleon.users.sourceforge.net/ ... xors3d.zip
I got connection problems while uploading it.
Tell me if it works.
Edit: I removed some files because I can't upload it.
Edit: I upgraded my DirectX and it seems not to work.
Edit: Here it is with all the files. I edited the *.bi file.
http://wargaleon.users.sourceforge.net/ ... xors3d.zip
I got connection problems while uploading it.
Tell me if it works.
Edit: I removed some files because I can't upload it.
Edit: I upgraded my DirectX and it seems not to work.
Creating a *.dll.a file:
pexports is from MinGW.
dlltool is included with FreeBASIC
pexports will spit a def file which contains the exported symbols.
As you have noticed, it exported its functions with @n in the end, so it is using stdcall. You should use 'Extern "Windows"' instead of 'Extern "C"'. The included headers already have them fixed. It also adds underscores, which is uncommon, that's what -U in dlltool for. Because you're using Extern blocks, you don't need the Alias'es.
dlltool will create an import library (*.a) for you.
http://wargaleon.users.sourceforge.net/ ... xors3d.zip
Same URL, I just replaced the *.dll.a file.
Code: Select all
pexports xors3d.dll > xors3d.def
dlltool.exe -U -l libxors3d.dll.a -D xors3d.dll -d xors3d.def
dlltool is included with FreeBASIC
pexports will spit a def file which contains the exported symbols.
As you have noticed, it exported its functions with @n in the end, so it is using stdcall. You should use 'Extern "Windows"' instead of 'Extern "C"'. The included headers already have them fixed. It also adds underscores, which is uncommon, that's what -U in dlltool for. Because you're using Extern blocks, you don't need the Alias'es.
dlltool will create an import library (*.a) for you.
http://wargaleon.users.sourceforge.net/ ... xors3d.zip
Same URL, I just replaced the *.dll.a file.
I tested and all working good with no bugs. Thanks!!! Tonight, I can continue to develop the Xors3D wrapper.Galeon wrote:Creating a *.dll.a file:pexports is from MinGW.Code: Select all
pexports xors3d.dll > xors3d.def dlltool.exe -U -l libxors3d.dll.a -D xors3d.dll -d xors3d.def
dlltool is included with FreeBASIC
pexports will spit a def file which contains the exported symbols.
As you have noticed, it exported its functions with @n in the end, so it is using stdcall. You should use 'Extern "Windows"' instead of 'Extern "C"'. The included headers already have them fixed. It also adds underscores, which is uncommon, that's what -U in dlltool for. Because you're using Extern blocks, you don't need the Alias'es.
dlltool will create an import library (*.a) for you.
http://wargaleon.users.sourceforge.net/ ... xors3d.zip
Same URL, I just replaced the *.dll.a file.
-
- Posts: 147
- Joined: May 24, 2009 23:13
- Location: Texas, United States, Planet Earth
- Contact:
Correct. They do have a 30 minute timer trial version, however.JohnK wrote:Isn't this a commercial library. That is with the wrapper the user still has to pay the cost of the DLL?
-JK
Still, it is nice to see more and more libraries wrapped into FB. For those who want to buy it, it is nice to know they can use it in FB.
David
Re: Need Help to wrap Xors3d.dll
Hi
This is th latest wrapper of Xors3D (latest DLL build of august 2012)
it adds many functions and subs especially the xcolor with alpha value (now you can draw transparent rectangles and text)
I added a helpfile for all the functions.
NB : for some reason to get this to work , you must remove the xphysics.dll file from the running folder! i dont know why the program hungs if you keep it.
you shall remove also any previous version (libxors3d.dll.a and xors3d.bi)
Test it and please feedback
for the keys => https://www.blitzbasic.com/Community/po ... pic=106322
Download Wrapper:http://www.megafileupload.com/3sb9j/xors3dN.rar
Enjoy
This is th latest wrapper of Xors3D (latest DLL build of august 2012)
it adds many functions and subs especially the xcolor with alpha value (now you can draw transparent rectangles and text)
I added a helpfile for all the functions.
NB : for some reason to get this to work , you must remove the xphysics.dll file from the running folder! i dont know why the program hungs if you keep it.
you shall remove also any previous version (libxors3d.dll.a and xors3d.bi)
Test it and please feedback
for the keys => https://www.blitzbasic.com/Community/po ... pic=106322
Download Wrapper:http://www.megafileupload.com/3sb9j/xors3dN.rar
Enjoy