dllimport

DLLImport Int** - How to do this if it can be done

狂风中的少年 提交于 2020-01-01 10:33:36
问题 I am trying to use a third party DLL that wants an int** as one of the parameters to the method. It describes the parameter as the address of the pointer that will point to the memory allocation. Sorry for any confusion. The parameter is two-way I think. The DLL is for talking to an FPGA board and the method is setting up DMA transfer between the host PC and the PCI board. 回答1: Use a by-ref System.IntPtr. [DllImport("thirdparty.dll")] static extern long ThirdPartyFunction(ref IntPtr arg);

DLLImport Int** - How to do this if it can be done

喜欢而已 提交于 2020-01-01 10:33:10
问题 I am trying to use a third party DLL that wants an int** as one of the parameters to the method. It describes the parameter as the address of the pointer that will point to the memory allocation. Sorry for any confusion. The parameter is two-way I think. The DLL is for talking to an FPGA board and the method is setting up DMA transfer between the host PC and the PCI board. 回答1: Use a by-ref System.IntPtr. [DllImport("thirdparty.dll")] static extern long ThirdPartyFunction(ref IntPtr arg);

DLLImport Int** - How to do this if it can be done

喜夏-厌秋 提交于 2020-01-01 10:33:04
问题 I am trying to use a third party DLL that wants an int** as one of the parameters to the method. It describes the parameter as the address of the pointer that will point to the memory allocation. Sorry for any confusion. The parameter is two-way I think. The DLL is for talking to an FPGA board and the method is setting up DMA transfer between the host PC and the PCI board. 回答1: Use a by-ref System.IntPtr. [DllImport("thirdparty.dll")] static extern long ThirdPartyFunction(ref IntPtr arg);

Free unmanaged memory allocation from managed code

故事扮演 提交于 2020-01-01 09:34:06
问题 A .NET application calls C dll. The C code allocates memory for a char array and returns this array as result. The .NET applications gets this result as a string. The C code: extern "C" __declspec(dllexport) char* __cdecl Run() { char* result = (char*)malloc(100 * sizeof(char)); // fill the array with data return result; } The C# code: [DllImport("Unmanaged.dll")] private static extern string Run(); ... string result = Run(); // do something useful with the result and than leave it out of

When is it appropriate to use the extern keyword without using the [DllImport] attribute?

走远了吗. 提交于 2020-01-01 09:24:08
问题 I was re-reading through some .Net documentation today when I noticed that the first portion of the extern keywords documentation claims: The extern modifier is used to declare a method that is implemented externally. A common use of the extern modifier is with the DllImport attribute when you are using Interop services to call into unmanaged code. What caught my attention was that the document states that "a common use" of extern is that it is used with the DllImport attribute. This implies

include c/c++ unmanaged code dll, consumed using dllimport, in azure functions publish process

隐身守侯 提交于 2020-01-01 07:23:13
问题 How does one include in a c/c++ unmanaged code dll, consumed using v2 .net core compatible DllImportAttribute statements, in azure functions publish process? I've confirmed it works in cloud deployment by manually copying, via azure storage explorer, to functions app storage account | file shares | | site/wwwroot/bin folder. Issue is now I haven't been able to find way to have it included in vs17 | | Publish process. Tried placing dll in \bin\$(Configuration)\netcoreapp2.1\bin folder before

What's the equivalent of WORD in C#?

我怕爱的太早我们不能终老 提交于 2020-01-01 04:15:09
问题 I'm trying to access an unmanaged library and am lucky to have access to a comprehensive guide to the API. Unfortunately, I've no idea what the C# equivalent of C++'s WORD type is. Similarly, I've no idea what DWORD would be. 回答1: You're probably looking for ushort for WORD and uint for DWORD. 来源: https://stackoverflow.com/questions/5490428/whats-the-equivalent-of-word-in-c

What is dllspec(dllimport) and dllspec(dllexport) means

半世苍凉 提交于 2020-01-01 00:49:08
问题 After googling, i came to know that Dllimport makes the function available for other modules, is it mandatory to declare function with extern "c" identifier? Also, Dllexport means, Dll itself uses the function while compiling it says. so by default all functions present in DLL are dllexport? 回答1: __declspec(dllexport) exports a symbol. It makes it available from outside a DLL. __declspec(dllimport) imports a symbol. It practically says "this symbol is not defined in this application, it needs

Retrieving dll version info via Win32 - VerQueryValue(…) crashes under Win7 x64

你。 提交于 2019-12-31 06:54:48
问题 The respected open source .NET wrapper implementation (SharpBITS) of Windows BITS services fails identifying the underlying BITS version under Win7 x64. Here is the source code that fails. NativeMethods are native Win32 calls wrapped by .NET methods and decorated via DllImport attribute. private static BitsVersion GetBitsVersion() { try { string fileName = Path.Combine( System.Environment.SystemDirectory, "qmgr.dll"); int handle = 0; int size = NativeMethods.GetFileVersionInfoSize(fileName,

import c++ dll to windows phone project

有些话、适合烂在心里 提交于 2019-12-30 10:37:29
问题 I'm new on windows phone developement and i have one problem that i don't know how to resolve.... the problem is.... i have a c++ project that i had complided with visual c++ 2010 and this create one dll with code compiled... so i know that C# import dll libraries but when i add refrences it's make this error "Unable to retrieve assembly fullname ""Parameter name: AssemblyPath" and i dont kown what it means... I searched on google and i found one method to import c++ dll manualy with