HumbleUI / Skija

Java bindings for Skia
Apache License 2.0
498 stars 34 forks source link

An errro UnsatisfiedLinkError #29

Closed 0Mamamia0 closed 1 year ago

0Mamamia0 commented 1 year ago

I got an error "java.lang.UnsatisfiedLinkError: io.github.humbleui.skija.impl.BufferUtil._nGetPointerFromByteBuffer(Ljava/nio/ByteBuffer;)J" when I type "BufferUtil.getPointerFromByteBuffer(...)" how dose it happens

dzaima commented 1 year ago

Maybe you need to do Library.staticLoad(); beforehand? (with import io.github.humbleui.skija.impl.Library;)

It seems that many classes do this themselves, but not BufferUtil.

tonsky commented 1 year ago

@dzaima good catch, thanks! You are totally right. Will fix in the next version, meanwhile Library.staticLoad() should do the trick

dzaima commented 1 year ago

@tonsky list of more files with native methods but no Library.staticLoad():

shared/java/Pixmap.java
shared/java/ColorType.java
shared/java/impl/BufferUtil.java
shared/java/impl/RefCnt.java
shared/java/impl/Managed.java

(not all of those necessarily need an explicit load, but I'm listing all occurrences anyway)

tonsky commented 1 year ago

Thanks for checking @dzaima !

tonsky commented 1 year ago

Managed/RefCnt don’t need it because they are not directly used, only through their implementations