Navigation  without Java Scripts

Using Visual Prolog DLLs from Java

The directory \Foreign\Examples\Java contains examples of how to use a Dynamic Link Library (DLL) created with Visual Prolog in a Java program (see Using Visual Prolog DLLs from other languages for an overview of the examples).

All these examples uses the same Visual Prolog DLLs that are found in the DLLS directory, so these have to be compiled before any of the examples are compiled and run.

Notes for Java

Please also read the common notes.

There is no common way to use a Visual Prolog DLL from Microsoft Java and Sun Java. In the case of Microsoft Java we use the J/Direct technology, and in the case of Sun Java we use JNI. Both these two technologies are too complex to describe in details here. In this context we will merely map Visual Prolog types to Java types:

Input types are mapped as follows:
Visual Prolog Java
integer int
real double
unsigned short
string class String

 

Output types are mapped as follows:
Visual Prolog Java
integer int[]
real double[]
unsigned short[]
string int[]

The actual value returned is the first stored as the first and only element of the array. In the string case the integer array contains a pointer to the string as its first element.

Examples

MSVJ example: Microsoft Visual Java program, which uses a non-GUI Visual Prolog DLL.
SunJava example: Sun Java program, which uses a non-GUI Visual Prolog DLL.