Questions tagged [dllimport]
Use this tag for questions about importing functions, data or objects from DLLs (Dynamic-link libraries).
2,303
questions
-1
votes
0
answers
65
views
MarkEzd.dll in C#
I want to use MarkEzd.dll in my c# code.
Does anyone have experience in using this dll?
Doc: https://dokumen.tips/documents/dynamic-link-library-for-developing-softwarepdf.html?page=1
From docs:
...
0
votes
0
answers
15
views
Import a .dll Library in VScode
I want to use a library in Visual C++.
I downloaded a folder called "Microsoft Visual C++"
In this folder I have 2 folders :
A file called "Definition Files" which contains .h ...
0
votes
0
answers
16
views
Trying to integrate my DLLs with 32-bit MetaTrader4 - Getting exported function not visible?
I'm trying to build an interface to MetaTrader4 - a dll so that I can ultimately use a named pipe to issue 'console' commands and have 2-way data interchange.
Installed tdm-gcc 32-bit in wine and ...
1
vote
1
answer
34
views
Using LibraryImport to import same function in multiple dlls
I am creating a .net WebAPI to facilitate a gradual move from Delphi code to C#, but our codebase is very large at 1.5M+ lines of code. So we are trying to break our application into small libraries ...
0
votes
0
answers
33
views
Unable to load DLL when running the C# project
I am attempting to develop a simple CppSharp project.
The implementation of the header file is as follows:
class Sample
{
public:
int a;
int b;
Sample(int a, int b){
this->a=a;
...
1
vote
1
answer
125
views
Could not load file or assembly System.Runtime, Version=7.0.0.0 when loading a compiled dll
I have a small dll compiled in Visual Studio written in C# (Class Library), which I want to use lateron in Matlab.
Currently my Target Framework is .Net 7.0 (but i have also tried different versions).
...
-2
votes
0
answers
63
views
Call C++ DLL with only __declspec exports from C#
I'm submitting a new question to a topic that has been discussed, as I can't find a solution or the exact same scenario as me.
I'm creating a .NET 8 solution and I'm trying to call C++ functions from ...
0
votes
0
answers
36
views
DLL converted from C++ .so unable to DllImport due to "Unable to find Entry Point"
Currently I have a legacy bcl_engine_rule.so file such that when it's DllImport-ed within a .cs file and running dotnet xxx.dll of the compiled C# file, the C# file was able make use of a function ...
-1
votes
0
answers
13
views
Compilation errors for app using SoLoud (Windows dll version) [duplicate]
It's been a few years since I last programmed in c++. I want to try out the soloud audio library (dll version) for a game project. However, I get 'undefined reference to ...' compilation errors ...
-2
votes
0
answers
40
views
C++ template class and functions in dll (error LNK2001: unresolved external symbol) [duplicate]
I am trying to split my project into exe and dll projects. I'm struggling with linker issues after moving a template class into dll.
I've seen similar posts but there is something I am apparently ...
0
votes
1
answer
47
views
calling a __thiscall DLL function from VC++ code
I have a DLL file to get reverse-engineered and I would like to call one of its functions (i.e. a class constructor) directly in my x86 C++ code. The reason is that I have no clue what the structure ...
0
votes
1
answer
73
views
Python: Import Error: DLL load failed : pybind11 c++ extension
I am struggling to refresh the pyEDM (https://github.com/SugiharaLab/pyEDM) package for windows. The package uses pybind11 to wrap the cppEDM (C++ computation engine) which calls LAPACK directly from ...
0
votes
0
answers
31
views
Export an entire class in a dll or just its methods to avoid C4251 warning
When I export a class that contains an STL object, a unique_ptr, my compiler generates the C4251 warning, telling me that I have to fully specify the unique_ptr.
class IMPORT_EXPORT_API Factory
{
...
0
votes
1
answer
54
views
Problem while loading third party dll in runtime using System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName
In my .NET Core 6.0 WebAPI project, I am trying to load third party dlls using System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName.
Frequently I see while loading the third party dlls it ...
0
votes
0
answers
55
views
Error on importing cv2 and mediapipe in python
I had installed both opencv-python and mediapipe modules using pip and my python version is 3.10.5, and when I try to just execute below two lines separately:
For importing cv2:
import cv2
then Iam ...
0
votes
1
answer
72
views
C# Created DLL .NET 7, DllImport Don't work
I don't understand why this error:
EdiUseDLL:
using System;
using System.Runtime.InteropServices;
class Program
{
const string Path = @"C:\Users\Maxim\Desktop\EdiUseDLL\EdiLibraryExample\...
0
votes
0
answers
65
views
IronPython v Python 3.11 - Importing .dll Libraries in Python 3.11
I am having an issue importing a .dll library in Python 3.11.
For IronPython, the import is successfull and looks as follows (example is for using the API of a structural analysis package called Robot ...
0
votes
0
answers
59
views
Pythonnet not able to import DLL because RGiesecke.DllExport.Metadata not found
I'm using Python 3.11.5 and Pythonnet 3.0.2 to import a DLL provided by my company to run some C# functions in a Python environment.
I was provided a script that would just do this:
import clr
clr....
1
vote
0
answers
57
views
Capture a screenshot of a newly created desktop not working win api
using System.Diagnostics;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Windows.Media.Imaging;
internal class Program
{
...
-1
votes
2
answers
66
views
Linking a .DLL in Visual Basic Class Projekt not working. FileNotFoundException
i want to build a DLL which imports another DLL in a fixed directory. The DLL which i want to import works with some relative paths which i cant modify and i dont have any insight in this "...
1
vote
1
answer
68
views
How to create an import library for kernel32.dll using a .def file on x86?
I have a small project that does not depend on the CRT or windows sdk. In order to link against kernel32.dll I created a minimal .def file with only the couple functions I need:
LIBRARY kernel32.dll
...
0
votes
1
answer
34
views
What directories are included if the SafeDirectories flag is set on the DefaultDllImportSearchPaths attribute?
The documentation for the DllImportSearchPath enum states the following:
SafeDirectories
4096
Include the application directory, the %WinDir%\System32 directory, and user directories in the DLL ...
0
votes
0
answers
26
views
I get syntax error when using loadlibrary i Matlab R2020b
I try to load a DLL library supplied together with an instrument,
and get syntax error from the compiler.
Error Message:
Error using loadlibrary
...
0
votes
0
answers
78
views
How can i combine my external c++ dll into my c# exe to have it a single file?
I am calling a function from my c++ dll in my csharp winform app, but I would like to know if there is a way to combine the external processFiles.dll into the .exe output to have a single file to ship....
1
vote
1
answer
49
views
How to get the string from an unmanaged void* parameter?
[DllImport("SiUSBXp.dll", CharSet = CharSet.Auto, EntryPoint =
"SI_GetProductStringSafe")]
static extern SI_STATUS GetProductString(
int dwDeviceNum,
...
0
votes
0
answers
26
views
How to add vb.net4 dll in ASP.NET Core 6 Web API project and how to configure the appsetiings to establish the connection string
I have added the DLL into my ASP.NET Core 6 Web API project, but I'm unable to get the data from referenced dll - please provide a solution.
How to establish connection between the referenced VB.net ...
0
votes
0
answers
113
views
Cannot import vtk module on Window's machine
For reproducibility, I'm using python 3.10.9, running Windows 10 Pro, version 22H2, build 19045.2965. And I'm trying to install vtk 9.2.6.
I create a virtual env with python -m venv env, activate the ...
0
votes
1
answer
48
views
.pyd not showing the modules anticipated
I have a freenect.pyd file compiled from c programs however when I import the function and call dir(freenect) its output is just ['__doc__', '__file__', '__loader__', '__name__', '__package__', '...
1
vote
0
answers
73
views
"DLL load failed while importing <module>: specified procedure not found" in all but the default anaconda environment
I want to import a python module (in the form of .pyd files for python 3.6 until 3.11) that is the API of a program I'm using. The import will fail with the message mentioned in the title except in my ...
0
votes
1
answer
206
views
Unity DLL could not be found when loading on ARM64
In my unity project I have 2 versions of my custom DLL, one for x86 and the other for ARM64 (for unity editor and target device respectively)
The x86 dll works as intended, however when deploying to ...
1
vote
0
answers
42
views
Exception of type 'System.AccessViolationException' occurred in Unknown Module. Attempted to read or write protected memory
I have created a c++ dll and using in the Project using [DllImport("dll")] while i am using this dll after build it crashes at following function AES_init_ctx();
This is my DLL Code:
"...
0
votes
0
answers
100
views
Exporting and Importing methods of the same name in C#
I ran into some unexpected behavior when playing around with native AOT in .NET 7 on Windows. It appears that if I export a method using the same name as a method I import from another native library, ...
-1
votes
2
answers
110
views
How to marshal this c struct and call its method in c#
I've seen answers similar to this in other places, but none of those solutions are working and usually they are slightly different questions. I haven't seen any of the other questions' solutions help ...
0
votes
1
answer
11
views
Calling OpeCL.dll API works from one project but not from another in same solution
I'm trying to use this nice OpenCL API library wrapper to work on neural nets with dotnet.
https://github.com/lecode-official/opencl-dotnet
The dotnet library projects in the repo are dotnet standard ...
0
votes
0
answers
126
views
Return structure from Delphi in c#
I have a function written in Delphi (dll) that return a structure. This must be use by DllImport.
TSettings = record
Error : integer;
NumOfAngles : integer;
Angles : array[1..21] ...
0
votes
1
answer
101
views
How to unload the DLL so that does not block a file on a disk?
I have DLL which reads and writes some text files. My main program writes a text file named Parameters.txt as an input data for DLL. I use LoadLibrarу() function to link DLL with my main program at ...
0
votes
0
answers
29
views
OriginalFirstThunk in memory
I understand the point of IAT/IDT/ INT and dynamically loaded DLLs at runtime. The OriginalFirstThunk in the Import Directory table refers to the function names stored (in the case of an ordinal) in ...
1
vote
1
answer
44
views
`tinyfd_selectFolderDialogW()` doesn't work from C# app
I have a cross-platform C# (.NET) application that uses a "tinyfiledialogs" library.
tinyfd_openFileDialogW() (and tinyfd_openFileDialog()) works as expected, but tinyfd_selectFolderDialogW()...
2
votes
2
answers
140
views
Marshaling an array of structs with `char` array fields in F#
The Csound API defines the following CS_AUDIODEVICE struct:
typedef struct {
char device_name[64];
char device_id[64];
char rt_module[64];
int max_nchnls;
int isOutput;
}...
1
vote
1
answer
81
views
How to include a DLL file and use it in C# with the "using" statement (and not installing/importing via VS)?
I'm trying to use a local DLL file in a .NET C# snippet that is used/called from within a PowerShell function.
The DLL file is the sensor library from LibreHardwareMonitor, that is normally installed ...
0
votes
0
answers
73
views
C# - Calling C++ crashes program
I am trying to learn how to call C++ code from C#. I am on a Windows 64 bit machine. I have a project which looks like this:
In funcs.cpp:
#include <cstdint>
extern "C"
{
...
0
votes
0
answers
16
views
Unable to Access Types from Compiled WPF Project Loaded as DLL using Roslyn Compile
I have a WPF project that I need to compile, load as a DLL file, and access its components programmatically. I'm currently using the Roslyn Compiler in my function, but I'm open to alternative ...
-1
votes
1
answer
52
views
C# - Problem passing a void* attribute of a struct to a C DLL
I have a C (not C++, as is most common) function in a DLL with the following signature:
unsigned long MyFunc(mystruct *arr, unsigned long arrLen);
where arr is an array of mystruct and arrLen is the ...
0
votes
0
answers
77
views
Export and Import viewer for DLL file Using C++
i want to write a program in C++ which takes a dll file and prints the exports and imports of it .
i use loadLibrary function like the code below . but it always go to the first if and return error , ...
0
votes
1
answer
101
views
How to correctly pick the dynamic library from the runtimes folder?
I am building a Nuget package that contains bindings for a dynamic library. There is a shared library (.so, .dylib, .dll etc) for each supported platform in the runtimes folder. I want the Nuget ...
0
votes
0
answers
52
views
Return C++ enum to C# - double free tcache 2 error
I'm trying to pass an enum to/from C++ and C#. Both are running on Linux. The program runs and works but upon the program ending I get a free(): double free detected in tcache 2 error and then a core ...
0
votes
0
answers
73
views
Linking OpenCV .dll files to your .dll project using Makefile
I want to add an external compiled dynamic library (here multiple .dll of opencv) to my own .dll project.
However, I succeed to compile it, but every time it crashes when I start it.
I look up and ...
0
votes
1
answer
81
views
How to use imported xsensdeviceapi64.dll classes and functions in Python code?
From Xsens Device API documentation:
The C++ interface is not available in compiled form but is provided as part of the SDK as source code that is incorporated in the C header files. This C++ ...
0
votes
1
answer
82
views
Can I modify (fill) array that I pass from C# to C++?
I have the next C# method:
internal static class FillArrayApi
{
[DllImport("NativeLibrary.dll", EntryPoint = "fill_array")]
internal static extern void FillArray(byte[] ...
-1
votes
1
answer
38
views
c# importing DLL function with const char **aString argument
I have a following export from my C++ dll:
extern "C" __declspec(dllexport)
uint64_t aFunction(const char **aString) noexcept
{
*aString = "Pointer to a string";
return 123;...