Skip to content

Instantly share code, notes, and snippets.

@saudet
Last active February 27, 2016 05:44
Show Gist options
  • Save saudet/a6a1264f6df639688d5a to your computer and use it in GitHub Desktop.
Save saudet/a6a1264f6df639688d5a to your computer and use it in GitHub Desktop.
Using JavaCPP without user-defined native libraries (bytedeco/javacpp@485081f)
// Build and execute normally:
// $ javac -cp javacpp.jar HelloPointer.java
// $ java -jar javacpp.jar HelloPointer
// $ java -cp javacpp.jar HelloPointer
import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.annotation.*;
@Platform
public class HelloPointer {
static { Loader.load(); }
public static void main(String[] args) {
FloatPointer p = new FloatPointer(100);
float[] a = new float[p.capacity()];
p.put(0, 42);
p.get(a);
System.out.println(a.length + " " + a[0]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment