Skip to content

Issue dereferencing JVM primitives / objects from codegen namespaces #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
enragedginger opened this issue May 10, 2021 · 0 comments
Closed

Comments

@enragedginger
Copy link
Contributor

I'm using the cv2 library. I ran the codegen on it, and swapped out my require-python usage of the library with a standard Clojure :require. An error is thrown when deref-ing constants from the generated namespace. Codegen creates this:
(def ^{:doc ""} COLOR_BGR2GRAY (as-jvm/generic-pyobject (py-global-delay (py/get-attr @src-obj* "COLOR_BGR2GRAY"))))

(py/get-attr @src-obj* "COLOR_BGR2GRAY") returns a java.lang.Long

When I try to use COLOR_BGR2GRAY, this error is thrown:

Error printing return value at tech.v3.datatype.ffi.ptr-value/unchecked-ptr-value (ptr_value.clj:17).
Item 6 is not convertible to a C pointer

I can reproduce this error with this:
(as-jvm/generic-pyobject (py-global-delay 6))

You can also replace 6 with some other JVM value (i.e. true or {:thing 1}) and reproduce the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant