i.e. is there a way in a Clojure source file to generate a class like
the one named GmpUtil in this Java program?
http://shootout.alioth.debian.org/u32/program.php?test=pidigits&lang=java&id=4
(class GmpUtil is near the end of the program -- here is a copy)
class GmpUtil {
static {
System.loadLibrary("jpargmp");
}
static native long mpz_init();
static native void mpz_clear(long src);
static native void mpz_mul_si(long dest, long src,
int val);
static native void mpz_add(long dest, long src,
long src2);
static native void mpz_set_si(long src, int value);
static native int mpz_get_si(long src);
static native int mpz_cmp(long dest, long src);
static native void mpz_tdiv_qr(long q, long r, long n,
long d);
}
I know that I can put that code into its own separate Java source
file, compile it to a class file, and use that class from a Clojure
program, although I've only found a way to do it if I put it into a
named package, e.g. I add a line "package gmp;" at the beginning of
the Java source file, and then import that package in the Clojure
source file.
A second question would be: Is there a way to compile such a Java
source file into the default package, and then use the class GmpUtil
from a Clojure program whose code is also compiled into the default
package? I know that there are limitations with the default package
in Java and Clojure, but not all the details of what those
restrictions are.
Thanks,
Andy
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en