I am trying to figure out how to use LWJGL3 directly from clojure. The only stumbling block I found so far is a function that sometimes requires an argument to be null
, but it's type is long
in the fingerprint.
The specific function in question is glfwCreateWindow
from the org.lwjgl.glfw.GLFW
class.
The last two arguments are long
, but they should be null
when using windowed mode, for the first one, or not sharing the gl context, for the second one.
The problem is interop calls check the fingerprint of the function and see it should be a long
, so passing nil
results in an IllegalArgumentException
.
I've looked all around, but nobody seems to have addressed this particular problem. It's not about nil-punning, since the argument should sometimes be nil.
This is my code that already works: https://gist.github.com/Efimero/2c0af4ae3aeaf2c85136aa06ff077919
But it only works because the default zero values are fine for my setup, but they're not abstract.
When I pass nil
I want the function to be called normally, but I get an exception.
This doesn't make sense. A long
cannot be null anywhere. It seems that this is a miscommunication in the documentation, where the wrapped C or C++ library leaks through.
I'd strongly guess that passing 0
where the documentation says NULL
is correct.