Is it possible to override a function, let's say..

you have DrawCircle PROC..
which would be coded for a basic circle (in the main files)

and DrawCircle PROC..
have extra attributes such as color and filled or outline (in some outside file, almost like a plug-in)

Are function pointers possible in asm? Or is it something else..

Edit: or function overrides is more like it..
Posted on 2003-10-16 23:01:27 by drarem
Well, you could call the procedure by a pointer, say define the pointer then call the DrawCircle function like this:
pDrawCircle dd ?


DrawCircle proc Param1,Param2,Param3
push Param3
push Param2
push Param1
call pDrawCircle
DrawCircle endp

_DRAWCIRCLEINTERN proc Param1,Param2,Param3
;Your procedure here

Then when you want to redirect the function you have only to change the offset in pDrawCircle. This is the same technique I use for API's that exist in some versions of Windows but not in others. The actual API is redirected to an emulator if it is not present in the OS version.
Posted on 2003-10-16 23:44:29 by donkey
perfect, thanks!!! :)
Posted on 2003-10-17 00:00:36 by drarem
I didn't want to waste a post, so..

Below is an outline of my new calling:

I have the framework together already, it doesn't do much except show a blank window.

The modular portion is the front end, if it is an MDI app, dialog app, etc.
The external projects, optional, will be geared more towards gaming, requiring at least one front-end.
WROOTS will contain all the macros and includes required for the lib itself.

My goal is to have something reusable and simple to implement, compiled into a .lib / .inc file. Any thoughts, comments, or insults on this are welcomed.
Posted on 2003-10-17 04:22:41 by drarem