开发者

Why dll doesn't run if VS2010 doesn't exist?

开发者 https://www.devze.com 2023-03-20 21:51 出处:网络
l\'ve written a dll on VS2010 and I will call it from JAVA by the help of JNA.But it doesn\'t run if VS 2010 doesn\'t exist on computer.It gives errors

l've written a dll on VS2010 and I will call it from JAVA by the help of JNA.But it doesn't run if VS 2010 doesn't exist on computer.It gives errors

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Unable to load library 'C:\Users\hasan\Desktop\cv-2dll.dll': The specified module could not be found. at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:166) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:239) at com.sun.jna.Library$Handler.(Library.java:140) at com.sun.jna.Native.loadLibrary(Native.java:393) at com.sun.jna.Native.loadLibrary(Native.java:378) at hsv.HSVHistogram.main(HSVHistogram.java:24) at hsv.HSVView.jButton1ActionPerformed(HSVView.java:231) at hsv.HSVView.access$900(HSVView.java:25) at hsv.HSVView$5.actionPerformed(HSVView.java:134) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6288) at javax.swing.JComponent.processMouseEvent(JComponent.java:3267) at java.awt.Component.processEvent(Component.java:6053) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4651) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Component.dispatchEvent(Component.java:4481) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577) at java.awt.LightweightDispatcher.proces开发者_如何学运维sMouseEvent(Container.java:4238) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168) at java.awt.Container.dispatchEventImpl(Container.java:2085) at java.awt.Window.dispatchEventImpl(Window.java:2478) at java.awt.Component.dispatchEvent(Component.java:4481) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643) at java.awt.EventQueue.access$000(EventQueue.java:84) at java.awt.EventQueue$1.run(EventQueue.java:602) at java.awt.EventQueue$1.run(EventQueue.java:600) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98) at java.awt.EventQueue$2.run(EventQueue.java:616) at java.awt.EventQueue$2.run(EventQueue.java:614) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:613) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


Your DLL probably needs the C/C++ runtime DLLs. The computer without Visual Studio 2010 installed probably doesn't have them.

Try compiling your DLL so that the C/C++ Runtime Library is statically linked into the DLL. Open the properties page for your DLL project in VS 2010, then select the Configuration Properties->C/C++->Code Generation subdialog and select Multi-threaded (/MT) or Multi-threaded Debug (/MTd). Once you recompile & relink the DLL it should run on systems without the VS 2010 runtime DLLs.

0

精彩评论

暂无评论...
验证码 换一张
取 消