![](/img/trans.png)
[英]java.lang.UnsatisfiedLinkError when loading topaz dll in OSGI environement
[英]OSGi service: java.lang.UnsatisfiedLinkError calling DLL — NO error when DLL called as unit test
用於視頻編碼的Java類加載包含C ++代碼的DLL
Unpacking debugging symbols for VideoSource.dll to \path
Checking for VideoSource.pdb...
Checking for videosource.pdb...
然后嘗試從該DLL實例化本機(C ++)類:
// VideoSource() is implemented in C++ and wrapped with JNI,
// wrapper files were generated with SWIG
_videoProvider = new generated.VideoSource();
當Java類作為JUnit測試執行時(提取視頻數據),該方法有效。
當我將Java類作為OSGi服務啟動時,同樣的事情不起作用。
本質上,執行相同的代碼。 DLL仍然可以成功加載,但是上面顯示的本機(C ++)類的實例現在引發異常:
java.lang.UnsatisfiedLinkError: generated.VideoSourceSWIGJNI.new_VideoSource()J
當我將Java類作為OSGi服務啟動而不是將其作為JUnit測試執行時,有什么不同? 我該怎么做才能使其正常工作?
背景
generate.VideoSource()是
public VideoSource() {
this(VideoSourceSWIGJNI.new_VideoSource(), true);
}
VideoSourceSWIGJNI.new_VideoSource()是
public final static native long new_VideoSource();
C ++實現是
VideoSource::VideoSource() {
// init frame count
m_frame_cnt = 0;
[..]
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.