• thinBasic 1.10.8.x

    thinBasic 1.10.8 released for BETA TESTING

    DOWNLOAD URL: https://www.thinbasic.biz/projects/t...c_1.10.8.0.zip

    Follow us in discussion: https://www.thinbasic.com/community/...Basic-1-10-8-x

    Very excited about new features.
    I published the list of changes already developed but still to be documented: https://www.thinbasic.com/public/pro...n_1_10_8_0.htm

    Personally ... I started to love FreeBASIC more and more during the last months.
    Especially when I discovered that JoseRoca (one of my programmer idol) started to use FreeBASIC for his WinFBX project: https://github.com/JoseRoca/WinFBX

    Thinking to a strategy for going out from using Power Basic as main compiler used to develop ThinBASIC, I've come to the conclusion that FreeBASIC is the best choice:
    • syntax not far from Power Basic so source porting will not be a nightmare but just a matter of time
    • both 32/64 bits
    • rich set of functions
    • nice community that recently seems revamped
    • and other reasons

    Porting ThinBASIC to be developed using FreeBASIC will be a long long run:
    • just ThinBASIC main Core engine is about 320K lines of code! excluding include file not developed by me ... remains about 170K lines of code
    • than there will be all ThinBASIC modules to recode, other 80k lines
    • thinAir, other 150k lines of code
    • thinDebug, other 50K lines of code
    • ...

    So it will take some time.

    But what to do in the meantime?

    Thinking on how to start I've decided to see if integration of FreeBASIC and ThinBASIC could be possible at script level in order to immediately give advantages and new features to programmers using ThinBASIC and at the same time experiment with FreeBASIC. And the following is the result of this initial integration.

    In next ThinBASIC version 1.10.8, that I will release in a couple of weeks, you will see the first results of integration and interop: it will be possible to mix FreeBASIC and ThinBASIC source code into the same script and do not care about details. ThinBASIC will take care of it:
    • extracting FreeBASIC code into a source code that will be compiled on the fly by FreeBASIC compiler
    • producing a DLL with the same name of the ThinBASIC source code
    • silently declaring exported FreeBASIC functions/subs into ThinBASIC source code in order to use FreeBASIC functions as native ThinBASIC functions

    It will be even possible to create ThinBASIC compiled new modules directly from a ThinBASIC script.

    First tests are very exciting.

    The magic is done by a new pre-parsing directive block #Compiled and #EndCompiled used to surround FreeBASIC code inside a ThinBASIC code.
    Than programmer just need to declare the functions/subs that need to be visible by ThinBASIC source code as ... CDECL ... EXPORT
    The rest is automatic

    Here an example of FreeBASIC/ThinBASIC integration.
      sub SayHelloFromFreeBasic cdecl alias "SayHelloFromFreeBasic" (byref sMessage as zstring) export
        print "Hi there. I'm FreeBASIC sub SayHelloFromFreeBasic"
        print "called from DLL:", sMessage
      end sub
    uses "Console"
    ' Thanks to thinBASIC autodetection,
    ' the FreeBasic function SayHelloFromFreeBasic is discovered automatically
    ' and can be used as native command
    printl "Press a key to end"
    Attachment 9976

    I've already tested almost all set of numeric data types passed both ByVal and ByRef.
    Also tested passing numeric arrays.
    Tested asciiz strings and I'm working on dynamic string and UDTs.

    After installation, please have a look at examples in \thinbasic\samplescripts\FreeBASIC\
    You will find interesting things over there and we can discuss for further improvements.