interop

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);

I want to know what functions are available from a Win32.DLL

谁都会走 提交于 2020-01-01 10:10:51
问题 I have a DLL file that has some helpful functions I want to call in my application. Unfortunately I don't have the documentation for it any longer. Is there any way I can discover what are the functions exported by the DLL and their method signature? Maybe there's a utility that lists the functions and their arguments. Know of any? 回答1: The windows SDK used to include the dependency walker GUI utility that can be used to explore DLL content: Dependency Walker is a free utility that scans any

Why would native code called from .net give different result from calling it from a native program?

我怕爱的太早我们不能终老 提交于 2020-01-01 07:25:07
问题 We've got a native library which we use to perform security related tasks for us. We've written an interop library so that we can use it from .NET. We've got two test applications, the first application is written in C++ (unmanaged) and the second is written in C#. They generate the exact same sequence of calls to the native library, but produce different results. I'm lost and can't find any apparent mistake in the .NET import definitions. I've already dumbed it down so that I only work with

MS Access interop - Data Import

白昼怎懂夜的黑 提交于 2020-01-01 07:07:07
问题 I am working on a exe to export SQL to Access, we do not want to use DTS as we have multiple clients each exporting different views and the overhead to setup and maintain the DTS packages is too much. *Edit: This process is automated for many clients every night, so the whole process has to be kicked off and controlled within a cursor in a stored procedure. This is because the data has to be filtered per project for the export. I have tried many ways to get data out of SQL into Access and the

make IntPtr in C#.NET point to string value

冷暖自知 提交于 2020-01-01 04:01:07
问题 I am using a class which has StringHandle field which is an IntPtr value that represents a LPCWSTR in C++. internal IntPtr StringHandle; // LPCWSTR say now that I have a String: string x = "abcdefg" How can I use the String handle to point to the beginning of the String so that it is like C++ LPCWSTR ? 回答1: You need to copy the string to the unmanaged memory first and then get the IntPtr from that location. You can do so like: IntPtr strPtr = Marshal.StringToHGlobalUni(x); also, you need to

Debugging C# assembly launched by embedded mono runtime?

删除回忆录丶 提交于 2020-01-01 03:30:06
问题 I am talking about a small game engine using C# for game programming. So, I have a C++ app embedding mono runtime (I call it 'launcher'). And I have an assembly written in C# which is my game engine class library. The launcher launches the assembly as it is suggested in Embedding Mono. And now the interesting part! The launcher implements in C++ miscelaneous functions which are exposed to the mono runtime as internal methods of my game engine classes. That is why my game engine assembly is

How to declare and implement a COM interface on C# that inherits from another COM interface?

为君一笑 提交于 2020-01-01 03:27:04
问题 I'm trying to understand what is the correct why to implement COM interfaces from C# code. It is straightforward when the interface doesn't inherit from other base interface. Like this one: [ComImport, Guid("2047E320-F2A9-11CE-AE65-08002B2E1262"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IShellFolderViewCB { long MessageSFVCB(uint uMsg, int wParam, int lParam); } However things start to become weired when I need to implement an interface that inherits from other

WCF Interop with Axis2 using WS-Trust

百般思念 提交于 2020-01-01 03:12:05
问题 We are trying to get WCF and Java talking to each other using SAML tokens issued from an STS. Despite the fact that both sides are compliant with the standards, WS-Security, WS-Trust, WS-Policy, etc., they don't seem to talk to each other and one or the other will throw cryptic exceptions or ignore security headers. We are using .NET 3.5, WCF Federation binding on the MS side, and Axis2/Rampart/Rahas on the java side. Has anyone ever been able to make this work? 回答1: Axis2 is incomplete in