[5910] in java-interest

home help back first fref pref prev next nref lref last post

How to call java methods and constructors from native C methods ?

daemon@ATHENA.MIT.EDU (Fabrice PARDO)
Mon Mar 4 15:34:07 1996

Date: Mon, 4 Mar 1996 17:36:34 +0100
From: Fabrice PARDO <fabrice.pardo@bagneux.cnet.fr>
To: java-interest@java.sun.com
Cc: fab@bagneux.cnet.fr

Q1) How can I call methods involving double args
Now I'm able to call with success execute_java_dynamic_method and
execute_java_constructor fonctions declared in java1.0/include/interpreter.h
if args are not double nor java long.

double Test_sqroot(struct HEssai *essai, double d) {
    ClassClass *cc=FindClass(0, "java/lang/Math", 1);
    long ret=execute_java_static_method(0,  cc, "sqrt", "(D)D", ?which args?);
    return ?what to return?;
}


Q2) How to pass arguments from a list ? With "..." args in C, I can suppose
that there is less than (for example) 10 args and pass always 10 args :
v[0], v[1], v[2], etc. v[9])
I think there is other functions, able to manipulate java stack.
Any documentation ?

Q3) Can I hope in a near future a java native compiler (on the fly or not) for
Solaris2 ? The objective is to use java for all applications, including
high efficiency standalone ones.

Q4) Can I hope also a development of Java/Tcl/Tk bindings in the sense of
the calling Java virtual machine from an interpreter like Tcl ?
A this time, I am able to call (Tcl7.5b2/Tk4.1b2), to keep control with
	tk.eval("vwait a_variable_marking_end_of_program");
and to send commands form another wish interpreter using "send" commands.
I want to do something like this
	tcl> java_constructor java.lang.Double D(2.0)
or	tcl> java_constructor java.lang.Double 2.0
this command will call java.lang.Double(double) constructor and will return
something like "java.lang.Double(0x12345678)"
	tcl> java_dynamic_method java.lang.Double(0x12345678) doubleValue
will return "2.0"
	tcl> java_static_method java.lang.Math.sqrt D(2.0)
will return something like "D(1.414)" or "1.414"

Fabrice Pardo
CNRS/L2M, Bagneux France
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post