Questions tagged [dynamic-dll-import]

15 questions
3
votes
2 answers

C# - Loading DLL Dynamic - System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types

In C#, while loading DLL from folder using the below code getting these below stack trace, when tried to get the types. var assembly = Assembly.LoadFile(assemblyInfo.FullName); // assembly loads perfectly using the absolute path. var types =…
Md. Alim Ul Karim
  • 2,401
  • 2
  • 27
  • 36
1
vote
1 answer

python cdll LoadLibrary and library resources relative paths

I'm trying to load the shared library which internally uses some resources. File structure is the following: dir_a/script.py dir_a/lib/lib.so dir_a/model/model.bin From script.py I'm using the following code to load tge library: from ctypes import…
Sergey Mozhaykin
  • 192
  • 1
  • 10
1
vote
2 answers

C# cannot use params object[] instead of __arglist

I am trying to call an unmanaged dll. While looking for information about this and trying it, I thought I could use params object[] instead of __arglist , so I changed it like the following code, but got different results. Why does this work…
Sia Luna
  • 11
  • 2
1
vote
1 answer

Wrong ctypes assignation

I made a CPP DLL and I'm trying to call function inside it from python. I've achieved this multiple times for other functions, but this one, I just can't find my mistake. dll_name = "..\\src\\x64\\Debug\\2019-3A-IBD-MLDLL.dll" dllabspath =…
BeGreen
  • 765
  • 1
  • 13
  • 39
0
votes
1 answer

Python CDLL: Problem with calling libc-Routines in dll

I'm having trouble with calling libc routines from a self compiled dll loaded with ctypes.CDLL. Here is a minimal example: DLL is generated in Visual Studio 2022 (OS: Windows 11, everything in 64 bit) with the VS dll standard template for…
0
votes
0 answers

ctypes.cdll and how to remap @executable_path

Trying to load a third-party library with cdll: import ctypes, os lib_dir = '/path/to/directory/containing' # this won't work: #os.environ['DYLD_LIBRARY_PATH'] = lib_dir lib = ctypes.CDLL(os.path.join(lib_dir, 'theLib.dylib')) however the…
fferri
  • 18,285
  • 5
  • 46
  • 95
0
votes
0 answers

problem with loading so with python ctypes CDLL

from ctypes import * import ctypes CDLL("./libfromandroid.so", mode=ctypes.RTLD_GLOBAL) hello, when i tried to run this code in my debian wsl i got error about not founding liblog.so so i downloaded it now it's giving me another error : File…
0
votes
0 answers

Using C++ SQLDriverConnect Connection Handle in C# as SqlConnection

Below code is used for SQL Connection in C++: SQLDriverConnect(hdbc, /* Connection handle */ 0, /* Window handle */ connectString, /* Connection string */ SQL_NTS, /* This is a null-terminated…
SoftWar
  • 63
  • 1
  • 7
0
votes
1 answer

How to send data from c++ application to dot net core app using Named pipeline

I have a dot net core application and I have to get the response from the C++ application. Also send the response back to C++ also. In simple terms, C++ -> C# C# -> C++ I have gone through many links and got to know we can use DllImport in the C#…
Gokul Kumar
  • 389
  • 6
  • 16
0
votes
1 answer

How to use .Net DLL in Uno Platform WASM?

I'd wrote a DLL in .net. I use it in UNO Platform for UWP. Now i'd like tu use some function of this DLL in WASM project. Is it Possible ? In UWP i connect the DLL in reference folder. In WASM how can i done ? Thanks
Daniele P.
  • 83
  • 10
0
votes
0 answers

Return type of the C function is always an integer while calling it using so file from python

I am trying to catch the return value of the function which written in .c file from .py file Here is my C code snippet and it runs perfectly with main function for itself, float checkRet(){ float a = 0.34; return a; } and here my python…
0
votes
2 answers

In Python, how to pass a callback array as arguments to a C function using ctypes?

This is my problem, I have a legacy library (.so) written in C with APIs like this: typedef void (*CALLBACK)( void); typedef CALLBACK CALLBACK_TBL[ 5 ]; void init(CALLBACK_TBL callbackTbl) { T_MYCALLBACK *myCallback1 = (T_MYCALLBACK…
0
votes
0 answers

Loading dynamcally a DLL inside another DLL

I'm trying to convert the functionality of our old code to a DLL. One of the function wants to export from our old code use a dynamically linked DLL (that I'm gonna call other) std::wstring otherDLL = L"C:\\PATH\\TO\\OTHER\\DLL" if (!(libOther =…
0
votes
1 answer

Callback function translation in C-DLL to java JNA

I am having a problem in mapping/translating a callback function from C-DLL to Java using JNA. on C header file following callback function is written: // ! callback function header whenever a data report is received from a device typedef void…
Sid
  • 15
  • 6
0
votes
1 answer

My DLL using COM objects with COINIT_MULTITHREADED is no more working on Python 3.7

I'm using a C++ DLL with python which makes use of COM objects. I'm loading it with cdll.LoadLibray. My application was working fine with python 2.7. Now that I'm moving to Python 3.7 my C++ DLL fails when I call:…
cabbi
  • 393
  • 2
  • 12