When importing Nim module for Lua bindings, error shows: "could not load: lua(|5.1|5.0).dll" - dll

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).

Related

cygwin: diff.exe: error while loading shared libraries: cygsigsegv-2.dll

I installed the latest cygwin x86-64. I added diffutils to get the basic diff(1) linux command. When I now run it, I get:
diff.exe: error while loading shared libraries: cygsigsegv-2.dll
I did a search for the dll here, but there are zero matches, not found.
I then re-ran the installer and did a search in the installer search box on this dll, and nothing came up.
Can you please advise?
cygsigsegv-2.dll is part of package libsigsegv2, which is required by
diffutils:
# diffutils
sdesc: "A GNU collection of diff utilities"
category: Utils
requires: cygwin libiconv2 libintl8 libsigsegv2
Installing that package should fix the problem.

regsvr32 fails for simple freepascal COM dll

I'm completely new to free-pascal and I try to implement a simple dll that should register a COM class.
Unfortunately I could only find little information about COM Programming for freepascal. Thus I hope that someone here can give me some hints or even a link to some examples.
So here is what I did:
my operating system is Windows 7 64 bit
downloaded and installed Lazarus 32bit version
Version #: 1.2.6
Date: 2014-10-11
FPC: Version 2.6.4
SVN Revision: 46529
i386-win32-win32/win64
installed the ActiveX package in Lazarus
made a new project - type Library with a simple TAutoObject and a default TAutoObjectFactory for the COM registration: source code included after this description
build the dll
use regsvr32.exe to register my dll --> this fails with
"make sure the binary is stored at the specified path ..."
Invalid access to memory location.
then I tried to change the default project options:
under Compiler Options - Config and Target, I set
Target OS: Win32
Target CPU family: i386
still the same error occurs
Project source
library LazarusSimpleComRegTest;
{$mode objfpc}{$H+}
uses
Classes,
{ you can add units after this }
ComServ, MyComObj;
exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer;
end.
MyComObj Unit:
unit MyComObj;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, ComObj;
const
CLASS_Plugin: TGUID = '{5E020FB0-B593-4ADF-9288-801C2FD432CF}';
type
TPlugin = class(TAutoObject)
end;
implementation
uses ComServ;
initialization
TAutoObjectFactory.Create(ComServer, TPlugin, CLASS_Plugin,
ciMultiInstance, tmApartment);
end.
I think the main problem was, that I did not include the type library as a resource in my dll file: Now it works fine.
I've made a very basic and simple working example on git-hub with some basic documentation:
lazarus-com-example

How to load a dll in Tcl?

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.

Not getting TBB to compile test examples

I am not getting TBB to work. I am following the steps in the "Getting started" document.
I am doing the following steps:
downloading the linux files + the sources files.
extracting them in 1 directory
calling make
going to tbb.../bin calling source tbbvars.sh intel64
going to examples/Getting_started/sub_string_finder
calling make
I then get the error:
sub_string_finder.cpp:32:30: fatal error: tbb/parallel_for.h: No such file or directory
I really googled a lot but can't find any related stuff.
I did also try to add some -I statement but it didnt help
I assume it is kind of a including/linking problem but I dont know how to fix.
This is all done on fedora 16 64bit. (kernel 3.1.4) // TBB version 4.0
The solution was to install tbb-devel package.

dlopen() error image not found

I have software that first loads a .dylib lets call libFirst.dylib using the following command:
void* handle = dlopen(path.c_str(), RTLD_LAZY | RTLD_GLOBAL);
Later on inside a function from the loaded libFirst.dylib I attempt to load another .dylib using the same command but for libSecond.dylib, the loading of this shared library gives me the following warnings in my Xcode console:
error warning: Ignored unknown object module at 0x129310 with type 0x8a8399
dlerror: dlopen(/path/libSecond.dylib, 9): Library not loaded: libFirst.dylib
Referenced from: /path/libSecond.dylib
Reason: image not found
What I don't get is that its says libFirst.dylib is not loaded but I am currently inside a function from libFirst.dylib, so how can this be?
All my paths in DYLD_LIBRARY_PATH appear correct too.
Thanks in advance, I have been stuck on this for days.
I ended up using -install_name to change the install name of all my libraries to #rpath/dylibName.dylib and then in Xcode I set the Runpath Search paths using #loader_path to find all my .dylibs that I was using.
use:
install_name_tool -id #executable_path/../Frameworks/mylib.dylib mylib.dylib
then check it with:
otool -D mylib.dylib
I think an easier way to get around this error would be to revert to an earlier version where you were not getting this error. Right click on the project folder and navigate to local history to revert to an earlier version. I verified this to be working on the android studio installed on Mac OS Big sur.