Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Official Delphi SDK Download

  1. #11
    Member
    Join Date
    Nov 2012
    Location
    Missouri, USA
    Posts
    113
    Rep Power
    29
    Eros,

    Thanks reopening the topic.
    First, I like to know where do I place all the files in the DelphiDLLTest.zip, or your thinBasic Delphi SDK.zip.
    Second, how was Michael able to post a reply after you had closed the topic?

    Bill

  2. #12
    Second, how was Michael able to post a reply after you had closed the topic?
    Because I seem to still have my super mod rights from way back. Eros, you can remove them if you want.

  3. #13
    Member
    Join Date
    Nov 2012
    Location
    Missouri, USA
    Posts
    113
    Rep Power
    29
    Thanks, Michael. Maybe you can reply to my "First" from above?

    Bill

  4. #14
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Quote Originally Posted by Billbo View Post
    Thanks reopening the topic.
    First, I like to know where do I place all the files in the DelphiDLLTest.zip, or your thinBasic Delphi SDK.zip.
    Second, how was Michael able to post a reply after you had closed the topic?

    Bill
    You can develop your Pascal module dll in any directory you want.

    When you need to test your module inside a thinBasic script you need to place your module dll in the same directory of your script.
    thinBasic will try to find it with a precise sequence that is described here: http://www.thinbasic.com/public/prod....html?uses.htm

    Inside your script, to load your module you need to use one of the following command:
    USES ... (if you module is named something like "thinBasic_" followed by your module name
    MODULE ... (if your module name has not "thinBasic_" as prefix)
    Again see help at http://www.thinbasic.com/public/prod....html?uses.htm

    Ciao
    Eros
    Last edited by ErosOlmi; 08-04-2016 at 15:31.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #15
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Quote Originally Posted by Michael Hartlef View Post
    Did I got it to work? What do you think?
    Sorry but not much time now at work. I will check this evening when back home and during the week-end.
    But if you succeed ... I will ... kiss on your lips
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #16
    Member
    Join Date
    Nov 2012
    Location
    Missouri, USA
    Posts
    113
    Rep Power
    29
    Eros,

    I appreciate the replay.

    Bill

  7. #17
    Sorry Bill, that was an overside from me.

    Eros, no kiss needed, i was just playing with. It looks like it will work but as it looks to easy, i am wondering if there could be a catch. You can debug the internals of thinbasic and you will see exactly if the returned string is fine.

  8. #18
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Quote Originally Posted by Michael Hartlef View Post
    Eros, no kiss needed, i was just playing with. It looks like it will work but as it looks to easy, i am wondering if there could be a catch. You can debug the internals of thinbasic and you will see exactly if the returned string is fine.
    Hi Michael,

    I checked your .pas code. I was ready to kiss you but unfortunately not

    All is working fine in your example because you are using thinCore *Delphi exported functions.
    Inside thinCore there are a lot of duplicated functions developed to handle FreePascal/Delphi strings as pointers to strings.
    For example when you call "thinBasic_ParseString_Delphi" the internal thinCore function executed is the following:
      '------------------------------------------------------------------------------
      FUNCTION Eval_StrExp_Delphi ALIAS "thinBasic_ParseString_Delphi" (BYVAL pMem AS DWORD PTR) EXPORT AS DWORD
      '------------------------------------------------------------------------------
        DIM sResult AS STRING
        DIM dLen    AS DWORD
        DIM pAsciiz AS ASCIIZ PTR
        DIM pByte AS BYTE PTR
    
    
        '---Parse a string expression into a PowerBasic strings
        Eval_StrExp(sResult)
        
        '---Now transform into a Delphi string
        dLen = Len(sResult) 
        If dLen = 0& Then Exit Function
        
        @pMem = da_MemAlloc(dLen + 8&)
        pByte = @pMem
    
    
        Poke Dword, pByte + 0&, 0&               
        Poke Dword, pByte + 4&, dLen            '---Lenght of the string buffer
        Poke$ pByte + 8&, sResult
        @pMem = pByte + 8&
    
    
        'FUNCTION = STRPTR(sResult)
        
      END FUNCTION
    
    As you can see the BSTR string is copied into a Heap memory buffer and returned as a pointer to it. It takes a lot of time to make all those conversions duplicating the needed memory.

    To use native BSTR strings you should create a Pascal module that does not need any of the *Delphi thinCore functions.
    And use one of the following exported functions that in PowerBasic are declared as:
      '---
      ' Parse one string expression including possible "(" and ")" before and after the string
      ' This function is the equavalent of the numeric thinBasic_Parse1Number 
      Declare Function  thinBasic_Parse1String                Lib "thinCore.DLL" Alias "thinBasic_Parse1String"               () As String
    
    
      '---
      ' Parse one string expression. It also returns the numeric representation of the parsed string in case it represents a valid number
      Declare Function  thinBasic_ParseString                 Lib "thinCore.DLL" Alias "thinBasic_ParseString"                (ByRef sResult As String) As Ext
    
    
      '---
      ' Parse one string expression.
      Declare Sub       thinBasic_ParseStr                    Lib "thinCore.DLL" Alias "thinBasic_ParseStr"                   (ByRef sResult As String)
    
    Mainly you need to use the same thinCore exported functions that are used to create a module using PowerBasic using all strings as native BSTR strings.

    Hope not to have confused you too much.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  9. #19
    I only changed the EXEC_SSS function, didn't touch EXEC_Reverse:

    And there I don't use the _DELPHI variants:

    //----------------------------------------------------------------------------// Returns the reverse of a specified String
    //--
    // thinBasic Syntax: s = Reverse(AnyStringExpression)
    //----------------------------------------------------------------------------
    Function Exec_SSS() : pWideChar; STDCALL;
    var wStringToReverse: WideString;
    
    
    Begin
    
    
      //---Init To nil To avoid compiler warning about possible undefined Return
      Exec_SSS := '';
    
    
      //---Parse the OPEN parenthesis
      If thinBasic_CheckOpenParens = _true Then
      Begin
    
    
        //---Parse the String expression needed To be reversed
        thinBasic_ParseString(wStringToReverse);
        //---Parse the close parenthesis
        If thinBasic_CheckCloseParens = _true Then
        Begin
    
    
          //OK, here we Do the job...
          //wStringToReverse := WideString(AnsiReverseString(String(wStringToReverse)));
          //...And Return result
          Exec_SSS := pWideChar(wStringToReverse);
    
    
        End;
    
    
      End;
    
    
    End;
    

  10. #20
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    mmmmm seems you got something new to my attention.
    I need to study it
    I have some doubt on memory release allocate by the pascal function?
    Will be able thinCore to release it?
    I will make some extreme test and see.

    In any case you example is much more close to the solution than all other tests I did in the past.
    For the moment, thanks a lot.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Delphi SDK Download
    By Petr Schreiber in forum Turbo Delphi language SDK development
    Replies: 1
    Last Post: 15-02-2006, 11:37

Members who have read this thread: 1

Posting Permissions

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