What I have tried (running Tcl and Tk 8.6.0 on Windows):
load D:/toot/bar/em.dll
load "D:/toot/bar/em.dll"
load D://toot//bar//em.dll
load "D://toot//bar//em.dll"
load D:\toot\bar\em.dll
load "D:\toot\bar\em.dll"
load D:\\toot\\bar\\em.dll
load "D:\\toot\\bar\\em.dll"
All of which return one of these two errors:
couldn't load library [what I put after 'load']: invalid argument
couldn't load library [what I put after 'load', rendered]: this library or a dependent library could not be found in library path
Assuming that file exists D:/toot/bar/em.dll returns truea, load D:/toot/bar/em.dll should work. However, it sounds like you've got problems with things (i.e., other DLLs) that the library depends on.
This is a general problem on Windows that has been asked elsewhere on Stack Overflow; the answers there are relevant to this question. You should also be aware that if the DLL has been linked against a specific version of the Tcl DLL (not recommended on Windows for Tcl extensions) then you need to have the same version of Tcl installed as it was linked against. Stub-enabled extensions do not have this problem at all (though they can still run into problems with other required libraries being absent).
It's a shame that the load command doesn't tell you what DLL is missing in its error message, but IIRC the underlying OS API doesn't report it either. You're stuck with using an external tool to diagnose these things…
a Don't worry about backslash/forward-slash issues; Tcl handles those for you.
I have this problem, too,couldn't load library "ChariotExt": invalid argument.
And sovled it by change tcl version x64 to x86.
Related
I'm new to the Nim programming language, and coming from a Lua background, it excited me to find out that there is a module for adding Lua bindings to Nim.
I installed Nimble (Nim's package manager) for Windows and executed "nimble install lua" to download and install the correct module. Upon trying to import it and compile the source, this happened:
C:\Users\Ashley\Desktop\Stuff\Coding\Nim\Projects\LuaTest>nim c -r "C:\Users\Ashley\Desktop\Stuff\Coding\Nim\Projects\LuaTest\main.nim"
Hint: system [Processing]
Hint: main [Processing]
Hint: lua [Processing]
CC: main
CC: lua_lua
Hint: [Link]
Hint: operation successful (10698 lines compiled; 1.262 sec total; 16.163MB; Debug Build) [SuccessX]
could not load: lua(|5.1|5.0).dll
Error: execution of an external program failed: 'c:\users\ashley\desktop\stuff\coding\nim\projects\luatest\main.exe '
I have Lua 5.1 already installed with the proper entries in PATH. It's located in Program Files (x86). The directory contains a dll called lua5.1.dll. I tried looking up the error on Google, but there were no results that helped. What could be the problem?
On Windows you can put the library at the same place as the generated binary. In this case the file should be called lua.dll, lua5.1.dll or lua5.0.dll. Also make sure that the library and binary are both for the same system architecture, either x86 (32bit) or x86-64 (64bit).
I'm trying to modify a .net application and I'm new to this. First step is attempting to deobfuscate the code using reflexil and I get the following error:
Reflexil is unable to clean this assembly: Member 'System.RuntimeTypeHandle "bunch of obfustatcated jibberish"(System.Int32)' is declared in another module and needs to be imported
The application comes with a bunch of dll's that it certainly uses, so I assume the declaration is in one of those files. How do I import this module?
In case it's helpful, reflexil says it was obfuscated with .NET Reactor 4.1
I decided to try de4not to deobfuscate and it worked without this issue.
I'm trying to work with the Java sample Database program from the CardScan SDK.
I am working with files located in Java/JNI and Java/Database. The program must be run with a 32 bit JRE. I was able to do so on a 64 bit machine by uninstalling Java and installing the 32 bit version, then re-adding the system path for Java. I can run the program and interface with a CardScan database file (.cdb) successfully by double clicking the SDKData.bat file, but when I open the source files for editing and edit the Java.library.path to include the required library (CRTK_JNI.dll), I get UnsatisfiedLinkErrors everywhere:
Exception in thread "main" java.lang.UnsatisfiedLinkError: sdkdata.CRTK.CRTK_Init([I)I
at sdkdata.CRTK.CRTK_Init(Native Method)
at sdkdata.CRTK.(CRTK.java:239)
at sdkdata.SDKData.(SDKData.java:97)
at sdkdata.SDKData.main(SDKData.java:643)
Java Result: 1
Presumably this is happening because the library is not loading properly.
What do I need to do to run and edit the program at full capacity (with all the native functions from CRTK_JNI in working order)?
Presumably this is happening because the library is not loading properly.
On the contrary. The library load is complete. You aren't getting that from a System.load()/loadLibrary() call, you are getting the error when calling your native method, the one that should have the signature:
package sdkdata;
public class CRTK
{
public native int CRTK_Init(int[]);
}
So it isn't there, or you have changed the signature without regenerating the .h and .c files, or you have manually mangled the declaration some other way.
Post your code.
To clarify, this Java sample program is officially unsupported by the CardScan API - it was a bad idea to try to use the API with an unsupported language relying solely on an experimental implementation. I ended up using one of the supported languages (Visual Basic) to work with the SDK; if anyone looking at this question happens to be struggling with using the CardScan API, here is my VB implementation on Github.
I've read lots of posts about this, but none address my problem.
I have a very small DLL that allows a Java process to send windows messages. It simply calls
FindWindowEx(...)
SendMessage(...)
I have compiled that with VS2005 and linked with /MT and all's fine, but if I try to make my DLL depend on MSVCRT and link with /MD then I get the unsatisfied link error.
java.lang.UnsatisfiedLinkError: MyDll.dll: Can't find dependent libraries
According to depends.exe it has two missing DLLs, GPSVC.DLL and IESHIMS.DLL. The first exists in c:\windows\system32 and the second is in a winsxs path. There are LOADS of other DLLs loaded from c:\windows\system32 and GPSVC.DLL is an odd one in that even as admin on my win7x64 machine, I cannot run depends on that - it says it's not found...
Anyway, I tried forcing a load of both of those DLLs in my Java by (simplified - I'm not in control of java.library.path)
Field field = ClassLoader.class.getDeclaredField("usr_paths");
field.setAccessible(true);
String[] paths = (String[]) field.get(null);
String[] tmp = new String[paths.length + 2];
System.arraycopy(paths, 0, tmp, 0, paths.length);
tmp[paths.length] = "c:/windows/system32";
tmp[paths.length + 1] = "c:/Windows/winsxs/amd64_microsoft-windows-ie-ieshims_31bf3856ad364e35_8.0.7601.17514_none_c06d7c9c27da8591";
field.set(null, tmp);
but that made no difference. I can fallback to make it statically linked, but I'd rather not.
Any ideas on what I can try next?
Antony
Well, I´m using Visual Studio 2010 but it could work on 2005 too.
You could try configuring the VC compiler using vcvarsall.bat that you can find in ProgramFiles in /MicrosoftVisualStudio20xx/VC .
You have only to launch vsvarsall.bat in Command Line with one of these options: x86 or ia64 or x86_amd64 or x86_ia64. I don´t know if it will help but it could be one of the problems that VC compiler is not configured to work with 64 bit machine.
When I´m working with JNI I use command line to compile the code and I had to configure the compiler on 64 bit machine.
Or you could pobably try to compile it via Command Line. Here is my favourite tutorial http://www.ibm.com/developerworks/java/tutorials/j-jni/index.html
When you link to an unmanaged library (say 'A.dll') which in turn links to another library ('B.dll'), and B.dll is missing, you will get a run-time error message about failing to load 'B.dll'.
But when you P/Invoke into 'A.dll' from managed code, you'll get a general exception of this form:
Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'A.dll': The specified module could not be found.
How can I get an error message that pinpoints the specific unmanaged dll file that failed to load, when p/invoking from managed code ?
I don't think there's any specific API you can use to pinpoint why LoadLibrary (the underlying Win32 API) failed for 'A.dll'. I recommend the use of a tool like Dependency Walker to troubleshoot DLL loading errors.
I'm not sure how you can get this in the form of an exception. When I run into this problem I usually try and open the DLL with depends.exe. It's pretty good and reporting missing dependencies that exist if the DLL is simply loaded from it's current location.
You won't be able to get an answer from the exception, but you can do it (with a lot of work) through Process Monitor. This article discusses how and also includes a tool to scan Process Monitor logs to find the specific problem.
http://tech.blinemedical.com/debug-could-not-load-file-or-assembly-or-one-of-its-dependencies/
The Fusion Log Viewer is a good tool to debug assembly loading problems in .NET apps.
For identifying general file-load problems, you can use Process Monitor.