Calling a java function with an optionally null argument from clojure

Efi

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.

Svante

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Problems calling a variadic Java function from Clojure

From Dev

Calling a Java static function from Clojure

From Java

Calling Java API from Scala with null argument

From Java

Calling Java from Clojure

From Java

Calling clojure from java

From Dev

Calling a Clojure Function from Haskell

From Java

Calling a very simple clojure function from Java does not work

From Dev

Problems calling a clojure function that takes a map as parameter from java

From Java

calling clojure from Java (Clojure Interop)

From Java

Calling java functions from Clojure

From Java

Java calling function with class in argument

From Dev

Elegant way to optionally supply an argument to a function in R?

From Java

Calling Java varargs method with single null argument?

From Dev

Optionally pass argument to MSBuild from powershell

From Dev

NoClassDefFoundError calling Clojure from Java (Android, LibGDX)

From Dev

Calling a method on a Java class from Clojure

From Dev

calling javascript function with an argument from html

From Dev

Postgresql calling a function in another function passing an argument from the main function

From Dev

clojure function name as argument

From Dev

Calling java function from dart

From Dev

Calling overloaded function from within another function with parent class argument

From Dev

Suitable Java type for a Clojure function which takes an argument?

From Dev

Calling a function with array as an argument

From Java

How to invoke Clojure function directly from Java

From Dev

Getting a null response when calling a php site function from java in android

From Dev

Calling a member function pointer passed as template argument from lambda crashes

From Dev

JS Error when calling function with argument from Template Literal

From Java

Calling a method of a Java object passed as argument to hooked function in Frida

From Dev

Get calling function name in Clojure

Related Related

  1. 1

    Problems calling a variadic Java function from Clojure

  2. 2

    Calling a Java static function from Clojure

  3. 3

    Calling Java API from Scala with null argument

  4. 4

    Calling Java from Clojure

  5. 5

    Calling clojure from java

  6. 6

    Calling a Clojure Function from Haskell

  7. 7

    Calling a very simple clojure function from Java does not work

  8. 8

    Problems calling a clojure function that takes a map as parameter from java

  9. 9

    calling clojure from Java (Clojure Interop)

  10. 10

    Calling java functions from Clojure

  11. 11

    Java calling function with class in argument

  12. 12

    Elegant way to optionally supply an argument to a function in R?

  13. 13

    Calling Java varargs method with single null argument?

  14. 14

    Optionally pass argument to MSBuild from powershell

  15. 15

    NoClassDefFoundError calling Clojure from Java (Android, LibGDX)

  16. 16

    Calling a method on a Java class from Clojure

  17. 17

    calling javascript function with an argument from html

  18. 18

    Postgresql calling a function in another function passing an argument from the main function

  19. 19

    clojure function name as argument

  20. 20

    Calling java function from dart

  21. 21

    Calling overloaded function from within another function with parent class argument

  22. 22

    Suitable Java type for a Clojure function which takes an argument?

  23. 23

    Calling a function with array as an argument

  24. 24

    How to invoke Clojure function directly from Java

  25. 25

    Getting a null response when calling a php site function from java in android

  26. 26

    Calling a member function pointer passed as template argument from lambda crashes

  27. 27

    JS Error when calling function with argument from Template Literal

  28. 28

    Calling a method of a Java object passed as argument to hooked function in Frida

  29. 29

    Get calling function name in Clojure

HotTag

Archive