Hi Primo,
sure thing, I am happy you find it interesting.
I will work on it today afternoon and will notify you here once ready
Petr
Hi Petr,
i refer to your project in https://github.com/petrSchreiber/Cal...from-ThinBASIC
when you have time only and if possible to add to the test_lib.tbasic and lib.rs how to pass an array of numbers, and an array of strings, and an array of UDT from thinbasic to Rust DLL and to get it back to thinbasic
the reason is that i want to test the rust dll speed in my example http://www.thinbasic.com/community/s...-as-FreeBasic)
and to compare its speed with the freebasic DLL i have used in that example and to the Oxygen module you have used there. of course after increasing the Simpson figure points to thousands so to notice the timings.
the UDTs can be :
or as you like more suitableType TBGL_TRGB r As Byte g As Byte b As Byte End Type Type TBGL_TVECTOR3F x As Single y As Single z As Single end type
Thanks
Last edited by primo; 19-07-2018 at 20:55.
Hi Primo,
sure thing, I am happy you find it interesting.
I will work on it today afternoon and will notify you here once ready
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
Hi Primo,
I think I have it for you I also did a minor cleanup of the whole repository and made it possible to use thinBasic strings without need to convert them to unicode first.
Please have a look here for new ThinBASIC definition:
https://github.com/petrSchreiber/Cal...lib.tbasic#L32
...and calling code:
https://github.com/petrSchreiber/Cal...ib.tbasic#L110
...and here for the Rust code being called:
https://github.com/petrSchreiber/Cal...fined_types.rs
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
you are so generous Petr to provide such a detailed code, which without i will never be able to send UDT array to Rust.
i have applied the instructions in README.md: cargo build --release, then i have found the rust_interop.dll in the Release folder. and after running the test_lib.tbasic it display the output in magnificent glory:
rust_tb2.PNG
but when i press a key to exit the program, the windows 7/x64 display a pop up: thinbasic has stopped to working ...windows is collecting....
your previous package does not display this message.
amazingly with the same DLL thinbasic does not display the error in windows xp/32
Thank you again, tomorrow i will try to run the Simpson figure generator using the Rust DLL according to the info and code you have provided.
Last edited by primo; 21-07-2018 at 07:28.
Hi Petr
just now i have found that the msg "thinbasic.exe has stopped working" happened only when we want to exit by pressing a key, but there is no error msg when we close the program from the 'X'
this is in windows 7/x64 with thinbasic V1.10.5.0
Hi Primo,
the root cause was mistake on my side - I passed array of two elements, but told Rust it is 10 element array.
Try now, I am pretty confident it will resolve the issue
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
Hi Petr
i have found that sin, cos, tan, sqrt, pow and others are not implemented naturally in rust and while searching there are a lot of chaos, there are other people don't know how to to run the math functions.
if there is something usable from the Rust servers will be great to add to your thinbasic_Rust package
Thanks
Hi Primo,
Rust of course has sin/cos/tan, these are the functions I need and love
They are functions of given data types, for example f32 (SINGLE) and f64 (DOUBLE).
Check this snippet:
See here what does Rust offer:let angle_deg: f32 = 45.0; // Equivalent of `dim angle_deg as single = 45`
let angle_rad = angle_deg.to_radians(); // Easy conversion to radians
println!("Sinus of {} degrees is {}", angle_deg, angle_rad.sin());
https://doc.rust-lang.org/std/primitive.f64.html
This is the link to explore Rust standard library:
https://doc.rust-lang.org/book/secon...ion/index.html
...and this is a very neat and complete book about Rust:
https://www.rust-lang.org/en-US/
Primo, what do you think about putting your DLL in Rust to GitHub? I would be happy to contribute, we could learn a lot and share the progress with the thinBasic community.
Just idea, not mandatory. I enjoy the discussion here a lot
Petr
Last edited by Petr Schreiber; 21-07-2018 at 20:23.
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
Hi Petr
i have tried every imaginable way but not a.sin(). this is working very nice.
i will read the book step by step at least the introductory parts.
but this tour with your thinbasic_Rust project was very useful and essential for me, and i think the others will find it like so.
Thanks
Bookmarks