flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > FASM OO library. Goto page Previous 1, 2 |
Author |
|
afw2004 29 Jan 2007, 09:20
I performed some updates to my lib. It now packed into dll, inheritance from classes implemented in the dll works.
Source code is in oolib.zip attached. Exeexample folder contains example of static linking. Dllexample folder contains similar example but linked with fcomclib.dll (my oo library). dllbuild folder - source code for building oo library.
|
|||||||||||
29 Jan 2007, 09:20 |
|
vid 29 Jan 2007, 10:36
afw2004: no error checking there?
|
|||
29 Jan 2007, 10:36 |
|
jbojarczuk 04 Feb 2007, 01:05
Hi tantrikwizard,
It is possible to do what you want with the preprocessor. I actually have been able to do it (I am doing a second library right now, because I want to do improvements on the first one, such as separating OS specific code from general code, so as to be able to port the whole thing to linux later on). The first library, besides being VERY OS oriented (WIN32), it was kind of product oriented (Lotus Notes, using the C API), and so it will not be useful for you guys (unless we have a Lotus Notes C api developer in here, also?). An example syntax (for an .inc file): Code: Class JRBBase ClassStartData .m_pvMain dv ? .m_cRefs dv ? ClassEndData ClassStartProc QueryInterface Proc Constructor Proc Destructor Proc QueryInterface Proc AddRef Proc Release ClassEndProc ClassEnd An example syntax (for an asm file): Code: ClassStartCode JRBBase ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PROCOBJ Constructor PARAMLIST a_pvThis dv ? a_pvMain dv ? PARAMLISTEND mov R4 , a_pvMain mov [R3 + JRBBase.m_cRefs] , vword 1 sub R4 , R3 mov [R3 + JRBBase.m_pvMain], R4 PROCOBJEND ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PROCOBJ Destructor PARAMLIST a_pvThis dv ? PARAMLISTEND PROCOBJEND ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PROCOBJ QueryInterface PARAMLIST a_pvThis dv ? a_ridIID dv ? a_pvObjRet dv ? PARAMLISTEND mov R4 , [R3 + JRBBase.m_pvMain] mov R1 , a_ridIID test R4 , R4 jz .NoMain add R3 , R4 mov R4 , a_pvObjRet JRBBase_QueryInterface R3 , R1 , R4 jmp .ret .NoMain: //Se este for o objeto principal mov R4 , a_pvObjRet xor R3 , R3 LocateGUID R1 , IID_IUnknown , .FoundThis , IIDBase , .FoundThis mov [R4] , R3 mov R1 , E_NOINTERFACE jmp .ret .FoundThis: mov R4 , a_pvObjRet inc vword [R3 + JRBBase.m_cRefs] mov R1 , 0 mov [R4] , R3 PROCOBJEND ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PROCOBJ AddRef PARAMLIST this dv ? PARAMLISTEND mov R1 , [R3 + JRBBase.m_cRefs] inc R1 mov [R3 + JRBBase.m_cRefs] , R1 PROCOBJEND ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PROCOBJ Release PARAMLIST this dv ? PARAMLISTEND mov R1 , [R3 + JRBBase.m_cRefs] dec R1 mov [R3 + JRBBase.m_cRefs] , R1 jnz .ret JRBBase_Destructor R3 xor R1 , R1 PROCOBJEND ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ClassEndCode Now, some observations that I have noticed during my first project: 1 - EXCEPTION HANDLING is good. You should definetely invest you time on it, it will pay for itself many times over. The biggest problem I had, however, was buffer overrun. I suggest you watch out for this, since Win32 exception handling will suffer from it as well. 2 - You may have automatic object creation and destruction in the stack. If I were you, I would not worry so much about heap. I have done one project, and I was able to do it in it's completion in the stack. If you do everything like a C compiler would, you will not have gains. I suggest you think about it for a little. This being said, I don't think you really need a project for this. Just sit down and start tweaking with fasm's preprocessor, and you will get what you want. Should you need help with anything, just ask (although most people here know *A LOT* more than I do), if I see your questions, I would try to answer them. |
|||
04 Feb 2007, 01:05 |
|
tantrikwizard 08 Feb 2007, 13:37
jbojarczuk wrote: Hi tantrikwizard, Hi, I have been re-tasked with some projects at work and haven't had much time to work on my library. The class decleration (minus the namespaces) were working somewhat and new/delete macros but that is about as far as i've gotten. The FASM preprocessor still has me a bit perplexed and I'm no guru on the subject so am learning as I go. Can you post your work to share with the rest of us? |
|||
08 Feb 2007, 13:37 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.