www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - dynamically loading a dynamic library from the program

reply Michal Kozakiewicz <michalkozakiewicz3 gmail.com> writes:
I read this article: https://dlang.org/articles/dll-linux.html
However, I did not find the answer to my questions.
===== ===== ===== =====

Facts:
a. I have closed-source dynamic library (DLL) on Windows (e.g.: 
AutoItScript).
b. I do not know the language and compiler in which it was 
created.
c. I can get a list of symbols from it.
d. I have function definitions from this library.

Questions:
1. In this case, can I use this library in the D language program?
2. How to create initialization?
===== ===== ===== =====

Facts:
e. Subthread "Dynamically Loading a C++ DLL From a D Program", 
from the article above.
f. I have a dynamic library created in C not C++ on Windows.

Questions:
3. Is it possible to use it regardless of the compiler that 
created it (e.g.: MinGW, MSVC)?
Jul 28 2018
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Saturday, 28 July 2018 at 22:30:38 UTC, Michal Kozakiewicz 
wrote:
 1. In this case, can I use this library in the D language 
 program?
 2. How to create initialization?
You can load it exactly the same way you would from C. The article you linked is about writing a DLL in D itself, but using a DLL from D is nothing special. Same functions as in C. The compiler of the dll doesn't matter.
Jul 28 2018
parent Michal Kozakiewicz <michalkozakiewicz3 gmail.com> writes:
On Saturday, 28 July 2018 at 22:47:33 UTC, Adam D. Ruppe wrote:
 On Saturday, 28 July 2018 at 22:30:38 UTC, Michal Kozakiewicz 
 wrote:
 1. In this case, can I use this library in the D language 
 program?
 2. How to create initialization?
You can load it exactly the same way you would from C. The article you linked is about writing a DLL in D itself, but using a DLL from D is nothing special. Same functions as in C. The compiler of the dll doesn't matter.
Thank you for your answer!
Jul 28 2018