You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package org.example;
import org.bytedeco.javacpp.annotation.Platform;
import org.bytedeco.javacpp.annotation.Properties;
import org.bytedeco.javacpp.tools.InfoMap;
import org.bytedeco.javacpp.tools.InfoMapper;
@Properties(
value = {
@Platform(include={"NativeLibrary.h"}
}
,target = "org.example.NativeLibrary"
)
public class NativeLibraryConfig implements InfoMapper{
@Override
public void map(InfoMap infoMap) {
}
}
main.java
package org.example;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
public class Main {
public static void main(String[] args) throws InterruptedException {
FloatBuffer output= NativeLibrary.test(ShortBuffer.allocate(256));
System.out.printf("cap:%d\n", output.capacity()); // Expected capacity is 256, actual is 1024.
output.array();
System.out.println(output.getClass().getName());
}
}
STDOUT:
cap:1024
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000077940422, pid=21564, tid=0x00000000000028e4
#
# JRE version: OpenJDK Runtime Environment (8.0_432-b06) (build 1.8.0_432-b06)
# Java VM: OpenJDK 64-Bit Server VM (25.432-b06 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# V [jvm.dll+0x1e0422]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# E:\test\javacpp_thread\hs_err_pid21564.log
#
# If you would like to submit a bug report, please visit:
# https://github.com/adoptium/adoptium-support/issues
#
The text was updated successfully, but these errors were encountered:
I have a c++ function like this:std::vector test();
when i use FloatBuffer to get the return of cpp function,it's get exception
here is the source code :
<NativeLibrary.h>
NativeLibraryConfig.java
main.java
STDOUT:
The text was updated successfully, but these errors were encountered: