Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: FreeBasic SDK: extended data type

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    51
    Posts
    8,343
    Blog Entries
    2
    Rep Power
    10

    FreeBasic SDK: extended data type

    I'm working on implementing thinBasic SDK for FreeBasic compiler but I'm stuck with EXTENDED data type.
    Most of the thinBasic SDK functions handling numbers are designed to work with EXTENDED numbers but EXTENDED are not supported natively by FreeBasic.

    So, for example, if a SDK function expect an EXT passed BYREF, how to handle in FreeBasic?

    Any help is appreciated.

    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

  2. #2

    Re: FreeBasic SDK: extended data type

    someone wrote a real10 library and it's included in the examples folder, but I must warn you that the output routine is not 100% solid, I will see if I can work on it on my days off (a week from now)
    you have to compile the library yourself from the command line.

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    51
    Posts
    8,343
    Blog Entries
    2
    Rep Power
    10

    Re: FreeBasic SDK: extended data type

    Thanks a lot.
    Do you know how to invoke FBC to compile the library? I can see a make file but no idea how to use it.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  4. #4

    Re: FreeBasic SDK: extended data type

    actually it's very simple, just launch the freeBasic command prompt, cd to real10\libreal10 and type make

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    51
    Posts
    8,343
    Blog Entries
    2
    Rep Power
    10

    Re: FreeBasic SDK: extended data type

    It doesn't work here. I have a lot of compilers installed and when I invoke MAKE it starts the Borland make utility.
    I need to check my path precedences and FreeBasic installation. I usually compile FreeBasic sources from inside FBEdit making a FBEdit project.

    Do not worry, I'll find a way.
    Thanks
    Eros
    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

    Re: FreeBasic SDK: extended data type

    you may need to have Mingw32 installed, anyway attached is the one I just compiled with the latest FB
    I believe my system to be clean but recommend you check for virus.
    Attached Files Attached Files

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

    Re: FreeBasic SDK: extended data type

    Thanks a lot. Compiled test example and is working fine.

    I will now work on thinBasic SDK interface. I do not need to make complex operations. I just need to declare some EXT numbers, pass them to thinBasic SDK functions, return values and convert to Double. All FreeBasic calculations will be performed with doubles.
    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

    Re: FreeBasic SDK: extended data type

    one thing you need to change is the ext structure, as it is defined in the real10 library it's 16 bytes, posibly for speed reasons.

  9. #9

    Re: FreeBasic SDK: extended data type

    Converting between 64 bit and 80 bit floating point is very simple with a little machine code
    We know that varptr always returns the variable address in the eax register so, all we have to do is formulate fld and fstp pairs which use the eax register as a simple pointer.


    I would suggest managing the conversion entirely on the FreeBasic side:

    FreeBasic[code=thinbasic]

    type extended
    dbl as double
    xtn as long ' assuming alignment to 4 bytes
    end type

    dim myvar as extended
    dim p as any ptr

    'convert from double to extended
    p=varptr(myVar)
    asm .byte &hdd, &h00, &hdb,&h38

    'convert from extended to double
    p=varptr(myVar)
    asm .byte &hdb, &h28, &hdd,&h18

    [/code]

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

    Re: FreeBasic SDK: extended data type

    Thanks to all.

    Charles, yes, I will do in FreeBasic all the stuff as you suggested.
    My target is not to duplicate thinBasic SDK just to be compatible with EXT and DOUBLE. I want all functions as they are and study some simple transparent way for FreeBasic programmers.

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

Page 1 of 3 123 LastLast

Similar Threads

  1. ThinBasic extended numbers in FreeBASIC SDK.
    By D.J.Peters in forum thinBasic SDK
    Replies: 16
    Last Post: 15-05-2011, 00:27

Posting Permissions

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