Results 1 to 5 of 5

Thread: Are Core-functions accessible to modules?

  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,526
    Rep Power
    170

    Are Core-functions accessible to modules?

    Sometimes i wish to use a thinbasic-core-function directly from a module,
    can it be declared as is to a module in pb?

    for example to substitute a function as
    String s = App_GetEntrypoint()
    
    ' simple as:
    
    Declare Function App_GetEntryPoint {Import|Lib}?  "thincore.Dll" Alias "App_GetEntryPoint" () as String
    
    if thinkeable then where can i find the for Alias required correct Upper/Lower-Case-spelling?

    I don't like the idea to override the core-function App_SetEntrypoint(<String or functions name>) and recklessl just to disable it - and when i could capture it by overriding the keyword to get the information what new name is used
    then i had to pass it further to thinCore - that were the same problem as above when to call App_GetEntrypoint.

    So maybe correct case for the Alias or if possible / if it has at all : Are there ordinals - would these be still valid in future versions or are they changing?




    Could thincore reply the request of a module if i send like

    Hey, core!

    I need to use some of your Functions, could you execute a few little commands for me?
    it's not even a real function that has to return something - just like a sub and all memory i will need is allocated
    already and i will only use virtual variables over my allocated memory.
    I just put the thinbasic-code as plain ASCII (or should it be UTF8?) somewhere at memory and send you a pointer and the count of bytes.
    In the beginning is a list of locations in memory and how to name and use them. All the little squares where the numbers
    are to read or write is on the second page, right after the last byte of code that is a CHR$(2 "File-separator"
    $CR & $LF & $SPC are previous - don't swallow the $FS that you will not choke on it, better parse it carefully.

    You execute that little bunch of functions as you always do - no foreign dialects - and call me back under codeptr(HereiAm) when you're done.
    The answering machine at my office in HereiAm is ready, just remember to mention that pointer that i gave to you.

    Just please do not release my scripts memory, since in the appendix are all these valuables, it would make me sad when these were lost.

    Or would you be so kind and do it instantly?

    Then just let me know when you're done and let the bell sound for a full row of Bits: 0xFFFFFFFF, TRUE , -1 ring-ring,
    ...or if you can not read my handwriting - sorry i was in a hurry - tell me please - maybe in range from 0x00000001 to 0x7FFFFFF to give me a clue, i have a list of Error-Codes in thinCore.inc, you know...
    - i will hang in here then and wait
    just making fun. Of course thincore will not reply such letter. But if i wrote a sub that works using virtual variables only,
    pass the startbyte and count of bytes of memory that holds thinbasic-code to execute, right after the script would follow the "variables" memory and the virtual variables positions were relative to the memory-position of the scripts last byte.

    Kind of embedding thinbasic to a module to allow modules performing operations the thinbasic-way. Maybe one:
    When variables start at firstScriptbyte + scriptlength it jumps to a zero-based world. If in such script a metavariable were
    present that holds position of the last byte of code ("LBC") , the first variables byte is LBC+1.
    Last edited by ReneMiner; 08-07-2022 at 16:43.
    I think there are missing some Forum-sections as beta-testing and support

  2. #2
    hello ReneMiner
    I use NTcore Explorer suite to view the exports of a dll https://ntcore.com/?page_id=388
    here are the exports of all the dll's
    Attached Files Attached Files
    Last edited by jack; 10-07-2022 at 16:55.

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Ciao,

    thinCore.dll exports a lot of functions but that exported functions are all designed to help Module Developers to scan thinBasic script source code at run-time and than do the job.
    You would like instead to have some thinBasic language keywords to be directly called from module and this is not possible.

    For example when you use LEFT$(anystring, nChars) internally thinBasic ...
    1. scan source code for "("
    2. then scan for a string expression (simple or complex expression)
    3. then scan for a ","
    4. then scan for a numeric expression (simple or complex expression)
    5. then scan for ")"
    6. and finally ... having all the data it needs, thinBasic do the job of taking nChars from the left of anystring and return string value
    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

  4. #4
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,526
    Rep Power
    170
    Quote Originally Posted by ErosOlmi View Post
    Ciao,
    ... this is not possible.


    Scary words. You should operate your brains more in "i don't care"-mode and not believe in such limitations as you will be caged by them. Just don't follow the rules that lead into a future of "not possible" - else you will end up in a future where "not possible" becomes the truth

    I will not call from the module to thinbasic/thincore.
    I think we need some pre-settings that do not break compatibility into the past. Currently thinCore calls

    LoadLocalSymbols

    to activate the module and the module must reply in that function to participate in execution of a script.
    Thats the issue why vb6-modules do not work, vb6 internally uses wide-string but for all API-calls it translates internally and passes ASCIIZ when the parameters are declared as Strings. thinCore expects a dynamic string similar to BString.
    Now it were a nonsense to create a translator like Douglas Adams "babelfish" that will let thincore understand ASCIIZ...

    1. thincore knows ASCIIZ.
    2. vb6 internally uses WIDE - conversion only takes place for String content when passed to API-functions

    We could use a modules versionInfo-Ressources, and a setting as "SpecialBuild" to give thincore some information before calling on LoadLocalSymbols. VersionInfo-Settings are using WIDE-strings.
    There could be a list of different codes that will thincore tell to use certain directives and options.
    The module that uses some options must set by thincore accepted switches to its versionInfo, "SpecialBuild"-data
    thincore can check this before calling to LoadLocalSymbols.

    a part of such setting could be "STRING= LONG WCHAR PTR, LONG COUNT" and that says: Instead of passing strings this module will pass 8 Bytes : A 32Bit Integer that points something that is a Widechar + a second 32Bit-integer that holds the count of elements.

    the count of elements for the string "thinbasic" is 9 - no matter what encoding.

    the buffer size in bytes is bytesPerElement * countOfElements .
    If element and bytesPerElement are not defined then Element = BYTE, bytesPerElement=1

    UTF8 is no option here - since bytesPerElement were dynamic for UTF8. Thinbasic users have sufficient options to pass strings in other encodings to a module
    Anyway languages using UTF8 themselves will not require babelfish-workarounds

    As vb6 only has 1 datatype that can be used to unite the 2 Long variables so for 1 string still 1 parameter can be passed it must use currency type.

    Doubles are dangerous to use: if memory-pointers are losing a bit on precision the screen will get dark...
    And the currency type is equal to quad. All it does differently is to display a dot in front of the 4th digit from right. That is no floating point arithmetic and as the value never is read nor set using the equal sign we are safe.
    Anyway thincore can receive it as a quad and also return a quad where a dynamic string were to receive as result.

    the problem were on Byval/ByRef how to proceed - thincore must set up rules

    releasing the memory that is used as substitute to pass a dynamic string to thincore is the responsibility of the module.
    releasing the memory that is used as buffer where parameters are passed byRef to thincore is the responsibility of the module.
    writing into memory that is was allocated by thincore to return requested data to a module is strictly forbidden.
    thincore might set up a rule when a module must write into such memory. like the count of elements is a value below 0
    means a buffer that expects data to be written into: max up to the abs(countOfElements*sizeInBytesPerElement)

    In case vb6 is especially interesting to have a core-function as Call_IfExists available
    it were the users script-functions name that will have to be called.
    for simplicity the called scriptfunctions should take 1 variadic parameter: 32Bit Integer. Mandatory.

    the functions could be somewhat special

    As thinbasics UI-callbacks are - but these anyway do not have function parameters.

    Lets say we change "Callback Function" to one keyword as "Eventprocedure"
    No parameters are passed to is by UI , only 1 Identifier as myButton_OnClick will follow
    the result is a long by default - no one would need to write like

    EventProcedure myButton_OnClick() As Long

    but

    EventProcedure myButton_OnClick

    would serve. if there is a "pseudo-variable" as EventComplete that were to set on TRUE after the users script has taken care of the event it were pretty much the "Function = -1" in a callback.
    the special results, for example in

    EventProcedure myDialog_OnSysCommand

    where the result must be 1 to cancel and stop the dialog from closing

    or NCIHITTEST where we have to reply what control or portion of the window was hit

    some other Pseudo-Variable can be used and EventComplete still tells thincore not to call any other EventProcedures
    like a "new" event for dialogs , syscommand = %SC_Close will call <dialogname>_OnClosebutton and have the variable
    EventCancel that a user can set TRUE while EventComplete means something else.
    For the HitTest it could work similar and have an EventTarget to receive a ControlID or controls name.

    btw. Names for controls & dialogs currently follow variable-naming-rules. If i were God in thinbasic-universe my rule were:
    Names must be 5 chars at least.
    Becaause then any identifier with 4 bytes is a controlID for controls or a handle for a Dialog.

    Now back to vb: if that uses variadic parameters to send the event-parameters as position, keyboard-key etc as Long array, it could use the same rules as strings and send pointer to first element and count of elements.
    if no elements? the first variadic value is 0 = we have one value always. No "Optional"-problem...
    I think there are missing some Forum-sections as beta-testing and support

  5. #5
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,526
    Rep Power
    170
    Actually i only need to call a thinbasic-scriptfunction to access heap that was allocated by thinbasic and there is no way fo a module to get the intenal handle that is required together with the heap-pointer (which is no problem to retrieve)
    I think there are missing some Forum-sections as beta-testing and support

Similar Threads

  1. Can oxygen "alias" TB-Functions from other modules?
    By ReneMiner in forum O2 JIT Compiler / Assembler / Oxygen project
    Replies: 4
    Last Post: 24-07-2013, 21:51
  2. New Core, more speed
    By ErosOlmi in forum thinBasic vaporware
    Replies: 20
    Last Post: 01-07-2008, 15:27
  3. amd dual core utility
    By kryton9 in forum General
    Replies: 0
    Last Post: 28-12-2007, 04:04
  4. Intel Core 2: just 105 errors
    By ErosOlmi in forum Technology
    Replies: 0
    Last Post: 04-07-2007, 14:56

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
  •