dll

Providing a function alias in gcc?

為{幸葍}努か 提交于 2021-01-29 03:38:53
问题 I'm looking for a way to define an unmangled alias for an exported function in a DLL compiled with GCC. According to this StackOverflow answer, Visual Studio supports #pragma comment(linker, "/EXPORT:SomeFunction=_SomeFunction@@@23mangledstuff#@@@@") to specify that an exported function shall have a given alias. I'm looking for something similar in GCC. The GCC function attribute docs suggest __attribute__ ((alias ("target"))) will do the trick, but this just generates a mangled function name

The type initializer for 'Npgsql.TypeMapping.GlobalTypeMapper' threw an exception

风格不统一 提交于 2021-01-28 20:10:58
问题 Using Visual Studio 2017 try using the Server Explorer to add a connection to a Postgres database. Click Test connection. The issue An error is shown with: The type initializer for 'Npgsql.TypeMapping.GlobalTypeMapper' threw an exception. Before that I installed System.Runtime.CompilerServices.Unsafe v4.5.2 and System.Numerics.Vectors v4.4.0 to fix the error message "Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1" and Could not load file or assembly

Use encrypted assembly in C# application

旧街凉风 提交于 2021-01-28 18:37:58
问题 I am trying to protect dlls I'm using in my WPF application from a simple copy. My solution is to encrypt the code section of these dlls and decrypt when it loads into my application. There is a working way to do that using Assembly: using (FileStream fs = new FileStream(@"Mydll.dll", FileMode.Open, FileAccess.Read)) { byte[] file = new byte[fs.Length]; fs.Read(file, 0, (int) fs.Length); assemblyCashCode = Assembly.Load(file); Type[] types = assemblyCashCode.GetExportedTypes(); Type t =

Use encrypted assembly in C# application

旧街凉风 提交于 2021-01-28 18:32:42
问题 I am trying to protect dlls I'm using in my WPF application from a simple copy. My solution is to encrypt the code section of these dlls and decrypt when it loads into my application. There is a working way to do that using Assembly: using (FileStream fs = new FileStream(@"Mydll.dll", FileMode.Open, FileAccess.Read)) { byte[] file = new byte[fs.Length]; fs.Read(file, 0, (int) fs.Length); assemblyCashCode = Assembly.Load(file); Type[] types = assemblyCashCode.GetExportedTypes(); Type t =

Dumpbin output meaning below .dll import part

北城以北 提交于 2021-01-28 11:33:37
问题 Here is a part of what I got when run dumpbin .exe file. Section contains the following imports: KERNEL32.dll 5A71E8 Import Address Table 620468 Import Name Table 0 time date stamp 0 Index of first forwarder reference 458 SetErrorMode 2B9 GlobalFlags 64 CompareStringW 206 GetLocaleInfoW 26E GetSystemDefaultUILanguage 418 RtlUnwind 300 IsDebuggerPresent 304 IsProcessorFeaturePresent B5 CreateThread 11A ExitThread 119 ExitProcess 217 GetModuleHandleExW 2D1 HeapQueryInformation 487 SetStdHandle

cmake : shared library : how to get the .lib name instead of .dll name?

耗尽温柔 提交于 2021-01-28 09:20:32
问题 Under Windows, with cmake I generate a shared library and an executable. The shared lib generate 2 files, a .DLL and a .LIB I use add_custom_command with $<TARGET_FILE:mylibname> , this output the name of the .DLL file. But, I need the name of the .LIB file. How can I do ? Any idea ? 回答1: Just found how, maybe it will be useful for someone else, so I share. Simply use TARGET_LINKER_FILE instead of TARGET_FILE ! 来源: https://stackoverflow.com/questions/48545720/cmake-shared-library-how-to-get

Python ctypes: Access violation

拈花ヽ惹草 提交于 2021-01-28 08:54:57
问题 I am trying to write a Python wrapper for a 3rd-party C DLL. The function WolaInit initializes the library and returns a handle to be used for subsequent function calls. import ctypes # Load WOLA DLL into memory. wolaDLL = ctypes.WinDLL("wola.dll") # Function prototypes WolaInit = wolaDLL.WolaInit WolaInit.restype = ctypes.c_ulong WolaInit.argtypes = [ ctypes.c_int, # La ctypes.c_int, # Ls ctypes.c_int, # R ctypes.c_int, # N ctypes.c_int] # stacking WolaGetStacking = wolaDLL.WolaGetStacking

Python ctypes: Access violation

旧城冷巷雨未停 提交于 2021-01-28 08:40:44
问题 I am trying to write a Python wrapper for a 3rd-party C DLL. The function WolaInit initializes the library and returns a handle to be used for subsequent function calls. import ctypes # Load WOLA DLL into memory. wolaDLL = ctypes.WinDLL("wola.dll") # Function prototypes WolaInit = wolaDLL.WolaInit WolaInit.restype = ctypes.c_ulong WolaInit.argtypes = [ ctypes.c_int, # La ctypes.c_int, # Ls ctypes.c_int, # R ctypes.c_int, # N ctypes.c_int] # stacking WolaGetStacking = wolaDLL.WolaGetStacking

Python ctypes dll load error 487

半腔热情 提交于 2021-01-28 07:44:51
问题 I am using Python 2.7 and trying to load a dll with ctypes: lib = ctypes.cdll.LoadLibrary("mylib.dll") It sometimes throws the following error, some other times it runs ok. Also with Python 3 always throws this error: libcrypto = ctypes.cdll.LoadLibrary("data\openvpn\libeay32") File "C:\Python27\lib\ctypes__init__.py", line 440, in LoadLibrary return self._dlltype(name) File "C:\Python27\lib\ctypes__init__.py", line 362, in init self._handle = _dlopen(self._name, mode) WindowsError: [Error

Can Python call C++ DLL libraries compiled using extern “C” with ctypes?

ⅰ亾dé卋堺 提交于 2021-01-28 07:03:38
问题 There are many articles on the internet that say that Python cannot access C++ compiled DLLs using ctypes , and there are other contradictory articles which say that it is possible to access the DLL so long as the DLL is compiled with the extern "C" method. So I just want clarification. Is it possible if extern "C" is used ? 回答1: There are C++-compiled dlls which can be used with ctypes and C++-compiled dlls which cannot be used with ctypes directly. If API exposes only plain-old-data (e.g.