JNI Poker Evaluation Library

The poker evaluation library is available at pokersource (GNU) The following code compiles a shared library that my HandEvaluator.java object can use to significantly speed up evaluation times. If the library in not present, the evaluation is done with slower pure java code. However, if it sees a shared library called libeval_.so, it will use the faster native methods to evaluate poker hands.

If you do not want the source, binaries for linux and solaris are downloadable below.

Source Code

Makefile

Note that the java includes will need to be changed to reflect your system.


##################
## for linux:   ##
##################
libeval.so: libeval.o lib/libpoker.a
    ld -shared libeval.o lib/libpoker.a -o $@

libeval.o:  feval.c
    gcc -fPIC -c -I/usr/local/jdk1.2.2/include -I/usr/local/jdk1.2.2/include/linux -Iinclude feval.c -o $@


##################
## for solaris: ##
##################
libeval.so:  feval.c lib/libpoker.a
    gcc -G -O4 -I/usr/local/java/include -I/usr/local/java/include/solaris -Iinclude feval.c lib/libpoker.a -o $@

Binaries

Simply place the appropriate file in the LD_LIBRARY_PATH and the HandEvaluator should detect it and use it. To see if it was successfully loaded, call HandEvaluator.isNative()