flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > object-oriented programming package for FASM |
Author |
|
IronFelix 04 Mar 2009, 15:02
Hi everybody!
OOP in FASM have already been discussed some times in this forum, and IMHO such library or package may be a useful tool. As for me - it is. That's why I spent some time to make such pakage for my needs and decide to release it to public now. Let me say some words about it: This OOP package is based on single inheritance mechanism with ability to implement multiply interfaces. Due to this, classes may have data fields, functions (static, virtual and abstract) and implemented interfaces and can be inherited with all of this. I have also made next things: 1. Some of COM and dynamic object creation/destruction functions are already implemented or automatically generated. 2. Run-time type identification (RTTI) mechanism. 3. Different call types (stdcall, cdecl and pascal) of classes functions support, including those of structure return type. 4. Compile-time detected OOP error messages mechanism. 5. Some optimization on classes is made automatically. 6. Some simple configuration mechanism to control work of this package. 7. Examples of COM programming and some other. 8. Some documentation, of course. All examples are written with FASM standard includes and OOP package. Please, tell me your opinion about this package - any improvments and suggestions are appreciated. And a question at the end - please, tell me if all of examples work on Windows <> XP SP3? Thanks.
_________________ Flat Assembler is the best! |
|||||||||||
04 Mar 2009, 15:02 |
|
Yardman 04 Mar 2009, 18:29
[ Post removed by author. ]
Last edited by Yardman on 04 Apr 2012, 03:26; edited 1 time in total |
|||
04 Mar 2009, 18:29 |
|
IronFelix 04 Mar 2009, 19:16
Do you mean OLE interfaces headers?
|
|||
04 Mar 2009, 19:16 |
|
IronFelix 23 May 2009, 12:10
Glad you like it, hopcode!
Please tell me, if next code is what you are asking about - it is modified basic example: Code: format PE GUI 4.0 entry Main CLASSES_DATA_MOVEABLE equ ; mark classes data as moveable ; FASM includes include "win32a.inc" ; classes package includes include "..\..\Classes Package\ClassesCfg.inc" include "..\..\Classes Package\ClassesMCode.inc" include "..\..\Classes Package\ClassesCore 1.8.inc" include "..\..\Classes Package\ClassesCode.inc" ; declare some simple class class TIndex field Index : DWORD = 0 ; suppose we have 2 functions to work with Index function Inc ; just for example - let it be virtual virtual_function Dec endclass ; code section section '.flat' code readable executable ; implement TIndex functions proc TIndex.Inc this ; increment our object index mov eax,[this] inc [eax + TIndex.Index] ret endp ; { TIndex.Inc } proc TIndex.Dec this ; decrement our object index mov eax,[this] dec [eax + TIndex.Index] ret endp ; { TIndex.Dec } ; ****************** PROGRAMM ENTRY POINT ****************** proc Main ; make calls of both TIndex functions ; this is call of static function of object objfcall IndObj->Inc() ; increment index ; make next call via supposed "untyped" pointer to object (just for example) ; this is call of virtual function of object mov eax,IndObj clsfcall TIndex(eax)->Dec() ; decrement index ; let see index value after calls ; it will be zero mov ecx,[IndObj.Index] ; exit process invoke ExitProcess, NULL endp ; data section section '.data' data readable writeable ; classes data in this case consist of TIndex vtable ; this vtable is of only one TIndex.Dec function address insert_classes_data ; put classes data here ; declare static instance of our TIndex ; it will contain pointer to TIndex vtable ; and value of Index = 0 IndObj TIndex ;********************* IMPORTS *********************** section '.import' import data readable writeable ;align 16 ;data import library kernel32, 'kernel32.dll' include "apia\kernel32.inc" ;end data classes_finalize ; finalize classes Any example can be done in such a way. Regards. |
|||
23 May 2009, 12:10 |
|
hopcode 24 May 2009, 07:48
IronFelix wrote: ...if next code is what you are asking about Yes, very flexible!!! that's exactly what i needed. Lot of thanx. I think that your macros will trace a new path in OOP (simple and COM) with Fasm. Regards, hopcode |
|||
24 May 2009, 07:48 |
|
IronFelix 24 May 2009, 08:05
You are welcome, hopcode!
Lot of thanks to Tomasz Crysztar for his amazing FASM! Regards. |
|||
24 May 2009, 08:05 |
|
vid 24 May 2009, 08:33
Grysztar
|
|||
24 May 2009, 08:33 |
|
IronFelix 24 May 2009, 09:54
Ooops Sorry, Tomasz !
|
|||
24 May 2009, 09:54 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.