Call Windows DLL from Elixir/Erlang - dll

I use a CAN communication driver DLL for windows, which I call/import from C++, and I was wondering if there was a way to wrap the DLL and call it directly from Elixir, or maybe Erlang.

Related

How to call c++ DLL from Chromium based App

I know there is a way to call c++ DLL from Chromium based App is DLL binding.
I want to know if I can call c++ DLL via the way of webassembly?

How to register a COM Component with install4j?

I have a COM dll I want to register while installing the application. I am using Install4j. Is there any way Install4j to register the COM component? It maybe possible to use a batch file that includes statement such as "RegSvr32 abc.dll". But It would be nice if install4j has built in support for registering COM components as most of the install makers support them.
As of install4j 5.1, there is no support for registering COM components. You would indeed have to put the regsvr32 invocation into a batch file and call it with a "Run executable or batch file" action.

Is it possible to call a native DLL from Adobe AIR?

Apparently it is possible to call a native executable from AIR using NativeProcessInfo. But can an AIR app call a DLL directly?
One possibility is to wrap the DLL is some kind of proxy EXE, but I'd like to avoid that, if possible.
By "call a DLL" you must be meaning retrieve pointer to some DLL function and invoke it. But how native code should execute in AIR application? AIR can run executables in separate processes, but what should it do with native code from DLL? You definitely need proxy exe to do that, at least to provide environment for function calls.

C++/CLI 64-bit COM

I have a C++/CLI assembly that wraps a native 32-bit dll.
The assembly is used both from .Net and COM (office).
Now I have a customer that runs 64-bit office.
Is it possible to create a C++/CLI assembly that uses a native 32-bit dll and exports a 64-bit com interface?
No, you can't mix code with different bitness in one process on Windows. You need to force 32-bit code into a separate process or convert that DLL.
The latter can likely be achieved by using COM+ (or DCOM which is mostly the same). This is what we usually do with native C++ code. I'm not sure about how easy it is with C++/CLI assemblies.
In a manner of speaking, yes.
Continue to compile the C++/CLI code as 32-bit so it can use the native library using C++ interop.
Then you will have to configure it to load as an out-of-process COM server when acting as an Office 64 plugin. With native COM code, midl automatically generates the 64-bit proxy. There should be some similar capability to create a proxy when registering .NET classes marked COMVisible.
The 64-bit COM interface will be contained in the auto-generated 64-bit proxy DLL, so this doesn't violate the rule that the bitness of all modules in a process must be the same.

COM calling convention on x64

I am trying to get a definitive answer regarding the way COM behaves on a x64 machine. Does Windows use the normal x64 calling convention when dispatching calls to COM interfaces on x64 machines (assuming the COM implementation is 64 bits)? Specifically, I dynamically generate my vtbl entries to point to a chunk of assembly that's dynamically loaded during runtime. This assembly needs to know how to get parameters correctly from whomever is calling it. Thus, I'd like to know if COM sets up the call to my assembly using the standard x64 calling convention (pretty much fastcall).
The COM calling convention is whatever the STDMETHOD/STDMETHODIMP macros (and their variants) defines it to be. On IA-32, it's stdcall for most of them; I do not know what is used on x86-64 (I only have the 32-bit mingw cross-compiler installed).