[kaffe] Question about function 'sysdepCallMethod'
Guilhem Lavaux
guilhem at kaffe.org
Fri Nov 11 13:22:52 PST 2005
Hi,
sysdepCallMethod is not simply this. It ensures that the arguments are
passed correctly according to the ABI for some architecture/os/compiler
combination. Generally it must be written in assembly or using some
tricks of the compiler. sysdepCallMethod takes a pointer to some
function, its arguments and then build a function call and finally call
it. Once the function returns, the returned value is taken from the
stack/registers and pushed into the return value memory.
Regards,
Guilhem.
qi fenghai wrote:
> Hi all, Please advise if 'sysdepCallMethod' can be implemented by this
> way as bellow:
>
> method 1:
> in JVM:
> typedef int (*FUNCTYPE)(); //function's return type is int
> FUNCTYPE *nativefunc = (FUNCTYPE)dlsym(handle, "foo");
> //four argument
> (*nativefunc)(1, 2.5);
>
> in share library:
> int foo(int, double);
>
> method 2:
> in JVM:
> typedef int (*FUNCTYPE)(...); //function's return type is int,
> argument list is '...'
> FUNCTYPE *nativefunc = (FUNCTYPE)dlsym(handle, "foo");
> //four argument
> (*nativefunc)(1, 2.5);
>
> in share library:
> int foo(int, double);
>
> _________________________________________________________________
> ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà MSN Messenger: http://messenger.msn.com/cn
>
> _______________________________________________
> kaffe mailing list
> kaffe at kaffe.org
> http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
>
More information about the kaffe
mailing list