Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/130.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java.lang.UnsatifiedLinkError映射C++;JNA的函数_Java_C++_Dll_Jna_Jnaerator - Fatal编程技术网

java.lang.UnsatifiedLinkError映射C++;JNA的函数

java.lang.UnsatifiedLinkError映射C++;JNA的函数,java,c++,dll,jna,jnaerator,Java,C++,Dll,Jna,Jnaerator,我必须将一个本地C++库映射到JNA,这是库头: #ifndef WORMDLL_H #define WORMDLL_H #pragma once #ifdef WORMDLL_EXPORTS #define WORMDLL_API __declspec(dllexport) #else #define WORMDLL_API __declspec(dllimport) #endif #include "wormError.h" typedef BYTE WORM_DATA; W

我必须将一个本地C++库映射到JNA,这是库头:

#ifndef WORMDLL_H
#define WORMDLL_H

#pragma once


#ifdef WORMDLL_EXPORTS
#define WORMDLL_API __declspec(dllexport) 
#else
#define WORMDLL_API __declspec(dllimport) 
#endif

#include "wormError.h"

typedef BYTE WORM_DATA;

WORMDLL_API WORM_ERROR  worm_readData(const char* mountPoint, WORM_DATA *data,const unsigned int offset,const unsigned int numBlocks);
#endif 
这是我用JNAeator做的映射:

package test;
import com.ochafik.lang.jnaerator.runtime.LibraryExtractor;
import com.ochafik.lang.jnaerator.runtime.MangledFunctionMapper;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import com.sun.jna.Pointer;
import com.sun.jna.PointerType;
import java.nio.ByteBuffer;

public interface TestLibrary extends Library {
    public static final String JNA_LIBRARY_NAME = LibraryExtractor.getLibraryPath("test", true, TestLibrary.class);
    public static final NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance(TestLibrary.JNA_LIBRARY_NAME, MangledFunctionMapper.DEFAULT_OPTIONS);
    public static final TestLibrary INSTANCE = (TestLibrary)Native.loadLibrary(TestLibrary.JNA_LIBRARY_NAME, TestLibrary.class, MangledFunctionMapper.DEFAULT_OPTIONS);


    TestLibrary.WORM_ERROR worm_readData(String mountPoint, ByteBuffer data, int offset, int numBlocks);

    public static class WORM_ERROR extends PointerType {
        public WORM_ERROR(Pointer address) {
            super(address);
        }
        public WORM_ERROR() {
            super();
        }
    };
}
这是DependencyWalker找到的导出函数:

(装饰) (未装饰)

当我尝试使用此配置运行测试时,我得到:

线程“main”java.lang.UnsatifiedLinkError中出现异常:错误 查找函数“worm\u readData”


为什么JNA找不到函数名?

@AntonSavin你说得对,对不起。这是另一个函数的测试。我更新了错误消息“你能发布Jnaborator命令行吗?我使用的是web start应用程序,而不是命令行,它可能会有所改变吗?我尝试了:
java-jar-jnaborator-0.12-shade.jar-library-wormdl-wormdl.h-mode目录-runtime JNA
以及runtime-Jnaborator,但它不起作用。我可以和BridJ一起跑!