Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #90
2011-10-23 23:04:54 UTC
This could be interesting, the current method is to create a pointer function
function* Name(params); DWord; stdcall;
and then assign the register to the function pointer.
Name = ebx;
if we come up with a way to allow the compiler to know which function method is inside ebx, then this will be possible...
Emil_halim
member
Posts
639
Threads
104
Location
Alex, Egypt
Post #95
2011-10-23 23:44:09 UTC
I think compiler did not need to know which function method is inside ebx, so
you can push all the parameters then emit call [ebx] instruction.
may be the point here is the calling type which mean ,cdecl , stdcall ,...etc
and the solution can be as the following.
Ebx(p1,p2,p3); // default to stdcall
Ebx(p1,p2,p3) as cdecl; // self explnaition
Emil.
http://www.freewebs.com/ogremagic/index.htm
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #96
2011-10-23 23:58:20 UTC
This is a fine solution, however it will not be able to type-check or check the amount of parameters; but i guess for such a thing it does not really matter. I will see about adding this for next release.
Emil_halim
member
Posts
639
Threads
104
Location
Alex, Egypt
Post #97
2011-10-24 00:10:11 UTC
very nice , thank you.
BTW , this feature will easily calling a function which stored in array , if we have
an array which hold a pointers to some functions , so we also do the following.
var1 = Ebx1 ; // call first function in array pointer.
var4 = Ebx4 ; // call 4 th function in array pointer.
and so on
what do you think ?
Emil.
http://www.freewebs.com/ogremagic/index.htm
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #99
2011-10-24 00:43:34 UTC
I am not too sure about that, since ebx[4] will be fourth byte of ebx... [ebx+3] .. i will look into that further.
meanwhile i have added register calling for next release, however it will be experimental, it will probably need alot of testing for the next few releases.
eax(1,2,3,4) as cdecl;
default is stdcall.
Emil_halim
member
Posts
639
Threads
104
Location
Alex, Egypt
Post #102
2011-10-24 08:00:57 UTC
yes , i was wrong , Ebx[3] is the fourth function in array.
implementing it with next release is very nice , :yess:
i will continue feeding another ideas.
thank you for your Ziron cake.
Emil.
http://www.freewebs.com/ogremagic/index.htm