Results 1 to 10 of 10

Thread: Article: Module classes

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

    Article: Module classes

    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

  2. #2
    So ,this news is ok.
    But still if i wanna write modul i must
    use Power Basic for this job.
    Best option will be if is posibile that
    we can make write modules with
    thinBasic like is posibile in DLib.
    In DLib are called userLibs...
    What you say about that?

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Well, I do not know DLib. As far as I can see many people loved it but actually it seems an abandoned project.
    thinBasic is not a compiler so it cannot create any library.

    In any case wait till I will release firt thinBasic version having the new class module classes inside.
    Than we will see

  4. #4
    Eros DLib is not compiler it is interpreter
    wich can bind source with runtime
    thats all.
    OK i will wait...

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    An interpreter cannot create runtime libraries (DLLs). Is like asking a car to fly: you need a plane.
    An interpreted can emit code (converting from its native syntax to other languages that can compile) into a different language that can compile. Many so called "compiler" are in reality code emitters (translators) into some ASM language. Than ASM is used to compile on the fly.

    But because I'm curious and I always try to learn something new, I just read about those "UserLibs" to get the idea about them. Downloaded DLib, red help, binary inspected such files. It seems that such files (.DCS) are just a collection of DLib source code made available as compressed (maybe encrypted) way. So such files are mainly like include files.
    The idea is not bad but you can create that kind of files only starting from DLib native language functionalities. You create some functions and say to DLib to make available as compressed/encrypted. They are not compiled at all. In few words it is just source code you cannot read.

    What I'm doing to do here is something completely different because I'm changing the heart of thinBasic Core engine.

  6. #6
    Yes Eros this is just source codes
    like include files it is not compiled of
    course.
    OK...

  7. #7
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    I'm almost ready to release this new feature. Stay tuned.

  8. #8
    hello eros, zlatko. I am just looking for a simple in freebasic written ( module ) example. there are any example for it? thanks, largo
    new edit: solved! found sdk folder with pb/fb files.

    I am curious to see new module functions to create with thinbasic.
    Last edited by largo_winch; 07-06-2011 at 11:14.

  9. #9
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Starting from thinBasic version 1.8.8.0 module classes are a reality.
    First module class developed is called cTimer and is native in thinBasic Core module, so available in every script.
    Full documentation in thinBasic help file.
    This is just a starter in order to test all possible aspects of this implementation.

  10. #10
    %thinBasic_ReturnNone             =  &h0 %thinBasic_ReturnCodeByte         =  &h1 %thinBasic_ReturnCodeInteger      =  &h2 %thinBasic_ReturnCodeWord         =  &h3 %thinBasic_ReturnCodeDWord        =  &h4 %thinBasic_ReturnCodeLong         =  &h5 %thinBasic_ReturnCodeQuad         =  &h6 %thinBasic_ReturnCodeSingle       =  &h7 %thinBasic_ReturnCodeDouble       =  &h8 %thinBasic_ReturnCodeCurrency     =  &h9 %thinBasic_ReturnCodeExt          = &h10 %thinBasic_ReturnNumber           = &h20 %thinBasic_ReturnString           = &h30  Declare Function FunctionGetPtr Lib "thinCore.dll" Alias "thinBasic_FunctionGetPtr" (ByVal fName As String) As Long Declare Function thinBasic_LoadSymbol Lib "thinCore.dll" Alias "thinBasic_LoadSymbol" (ByVal SymbolName As String, ByVal ReturnCode As Long, ByVal FunctionOrSubPointer As Dword, Optional ByVal ForceOverWrite As Long) As Long Declare Function thinBasic_Class_Add Lib "thinCore.dll" Alias "thinBasic_Class_Add" (ByVal sClassName As String, ByVal pClassFunc As Long) As Long Declare Function thinBasic_Class_AddMethod Lib "thinCore.dll" Alias "thinBasic_Class_AddMethod" (ByVal pClass As Long, ByVal sMethodName As String, ByVal MethodReturnType As Long, ByVal pMethodFunc As Long) As Long  Local RetCode As Long  TYPE IrrlichtDevice DWORD 	run As Long END TYPE  Local IrrlichtDevicePtr As Long = thinBasic_Class_Add("IrrlichtDevice", Function_GetPtr(IrrlichtDevice_run)) If IrrlichtDevicePtr Then 	RetCode = thinBasic_Class_AddMethod(IrrlichtDevicePtr, "run", %thinBasic_ReturnNumber, Function_GetPtr(IrrlichtDevice_run)) 	RetCode = thinBasic_Class_AddMethod(IrrlichtDevicePtr, "getVersion", %thinBasic_ReturnString, Function_GetPtr(IrrlichtDevice_getVersion)) Else 	Uses "console" 	PrintL "ERROR thinBasic_Class_Add IrrlichtDevice" End If
    
    I'm trying to do so and it might work, but is not suitable for Function_GetPtr code (and TYPE are also under suspicion). Here is the correct function for passing a pointer?
    Last edited by maxim; 30-06-2011 at 16:40.

Similar Threads

  1. Module classes
    By ErosOlmi in forum thinBasic vaporware
    Replies: 19
    Last Post: 02-12-2011, 12:15

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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