Author Topic: Method overloading  (Read 2660 times)

HSE

  • Member
  • *****
  • Posts: 2491
  • AMD 7-32 / i3 10-64
Method overloading
« on: October 01, 2018, 10:57:00 AM »
Hi Biterider!

Playing with the idea of overloading, I make it to work after a while.
Code: [Select]
VirtualMethod macro MName:req, Args:vararg
    MNameO textequ @CatStr (&MName , argcount(Args)) 
    PrototypeMethod %ObjName, %MNameO, Args
%   ??Index = &ObjName&_VtlMtdCount + 1
%   &ObjName&_VtlMtdCount = ??Index
%   @CatStr(%ObjName, <_VtlMethod_Name_>, %??Index) textequ <MNameO>
%   @CatStr(%ObjName, <_VtlMethod_Proc_>, %??Index) textequ <offset @CatStr(&ObjName&,<_>, %MNameO)>
%   @CatStr(%ObjName, %MNameO,<_Access>) = ??MethodAccess
endm

Very clear in VirtualMethods:
Code: [Select]
VirtualMethod  InitSerie, DWORD, DWORD, DWORD    ;-> Prioridad, Color, Modalidad
  VirtualMethodO InitSerie, DWORD, DWORD    ;-> Modalidad, Color o puntero a estructura

Not so nice when RedefineMethod:
Code: [Select]
  RedefineMethod  Init, DWORD, DWORD, DWORD    ;-> Prioridad, Color, Modalidad
  VirtualMethodO  Init, DWORD, DWORD    ;-> Prioridad, Color, Modalidad
In this case the overloading is by number of arguments, but it's posible also by argument types.

I don't know if worth the additional preprocessing. Now I only testing without change main macros, instead I added VirtualMethodO, MethodO and OCallO.

Regards. HSE
Equations in Assembly: SmplMath

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 1082
  • ObjAsm Developer
    • ObjAsm
Re: Method overloading
« Reply #1 on: October 01, 2018, 04:15:03 PM »
Hi HSE
Interesting purposal  :t
I'll look into it, but I'm very busy atm. I'm working on the header translation and and an a name mangling concept to prevent object and method name collisions with existing APIs. COM is still a challenge to get the multiple definition styles in MS headers to work consistently in asm.
I'll come back to you.  ;)

Biterider

HSE

  • Member
  • *****
  • Posts: 2491
  • AMD 7-32 / i3 10-64
Re: Method overloading
« Reply #2 on: October 01, 2018, 09:44:00 PM »
 :t
Equations in Assembly: SmplMath