dllimport

using uDMX API in c#

流过昼夜 提交于 2020-01-25 08:06:09
问题 I am relative new in c# and I want to use this uDMX API, but when I try to add the uDMX.dll file I get this error: "The reference is not vaild or not supported" (see screenshot (in german)) - I can't add images yet - Or am I doing it completely wrong? I did not find another uDMX api or .dll file. Hope for your help and Ideas. 回答1: You cant import an unmanaged win32 dll into a managed c# application like that, you need to specify the methods and parameters yourself. The uDMX api exposes these

using uDMX API in c#

陌路散爱 提交于 2020-01-25 08:05:46
问题 I am relative new in c# and I want to use this uDMX API, but when I try to add the uDMX.dll file I get this error: "The reference is not vaild or not supported" (see screenshot (in german)) - I can't add images yet - Or am I doing it completely wrong? I did not find another uDMX api or .dll file. Hope for your help and Ideas. 回答1: You cant import an unmanaged win32 dll into a managed c# application like that, you need to specify the methods and parameters yourself. The uDMX api exposes these

Calling DLL Functions under a namespace in RAD Studio

人盡茶涼 提交于 2020-01-25 06:49:09
问题 I'm new to using RAD Studio as I currently have to use it for this current project. What I am trying to do is call functions defined in a DLL file which I generated in Visual Studio in a RAD Studio C++ project . Following the advice from this question below Using Visual Studio DLL in Embarcadero RAD Studio XE? I have converted the C++ DLL file I have generated from Visual Studio to a supported file for RAD studio using their command: mkexp pub-sub-sample.a pub-sub-sample.dll I can verify that

Calling a class defined function from a DLL file C++

孤人 提交于 2020-01-25 06:47:09
问题 I've built an example project from the Amazon IoT Device SDK which is the PubSub Sample project from the examples folder. I've had to output the project as a DLL file so that the sample can be used in RAD studio, which I have been able to build successfully. Using the tutorials from generating a DLL, I've added in the __declspec(dllexport) line to the function definitions in the class. PubSub.hpp file #ifdef PUBSNUB_EXPORTS #define PUBSNUB_API __declspec(dllexport) #else #define PUBSNUB_API _

FreeLibrary returns true indefinitely

别说谁变了你拦得住时间么 提交于 2020-01-24 00:40:17
问题 Is there any reason why FreeLibrary would repetitively return true? I'm trying to unload some native dll from my process, so I'm getting it's handle and then calling FreeLibrary until the ref count goes to zero and so FreeLibrary returns false... but it never does: IntPtr pDll = DllLoadingImports.LoadLibrary(dllTounLoad); //throw if pDll == IntPtr.Zero while(DllLoadingImports.FreeLibrary(pDll)); The code runs and never returns. Also the process explorer shows the dll still loaded. More

Windows 8 printing Postscript file programmatically

拟墨画扇 提交于 2020-01-23 09:11:07
问题 I've spotted a strange problem while printing a Postscript file . So here is my setup: I have a Windows 8 PC , on this PC there is an C# application "NetworkPrintTest.exe", which, when executed, should open a PDF, generate a Postscript file and ultimately should print it. But it doesn't do anything. I don't get an error but it won't print either. The same program runs error free on windows 7 and i even get the printer to print the file. As mentioned above the .ps file is generated

C# - Method's type signature is not PInvoke compatible

岁酱吖の 提交于 2020-01-17 15:41:12
问题 I am trying to use the VC++ (2003) dll in C# (2010) When am calling the method of dll from c# am getting this error "Method's type signature is not PInvoke compatible" I am returning the structure from VC++ Code: struct SLFData { public: char ByLat[10]; char ByLong[10]; }; And I am marshalling in C# Code: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct SLFData { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public char[] ByLat; [MarshalAs(UnmanagedType

C# DllImport calling un-managed C++ function callback

江枫思渺然 提交于 2020-01-16 09:02:12
问题 Hi I have a C# WinForm app, I am able to call functions from the libnetclient.dll via DllImport like below: [DllImport("libnetclient.dll", CharSet = CharSet.Auto)] public static extern int NETCLIENT_Initialize(int bPriorRGB16 = 0); I am then able to use the functions as normal such as below: int ini = NETCLIENT_Initialize(); memoBox.AppendText("NETCLIENT_Initialize = " + ini.ToString()+Environment.NewLine);//append to box This callback occurs once the login function has completed. My problem

Tutorial needed on invoking unmanaged DLL from C#.NET

痴心易碎 提交于 2020-01-15 09:15:34
问题 I have a DLL from a vendor that I Need to invoke from C#. I know that C# data classes are not directly compatible with C++ data types. So, given that I have a function that receives data and returns a "string". (like this) string answer = CreateCode2(int, string1, uint32, string2, uint16); What must I do to make the input parameters compatible, and then make the result string compatible? Please - I have never done this: Don't give answers like "Use P/Invoke" or "Use Marshal" I need a tutorial

Debugging DLLImport in C#

◇◆丶佛笑我妖孽 提交于 2020-01-15 09:01:00
问题 I have been attempting to get the MySQL Embedded Library working in my C# application for the past 12 hours or so, and have been stuck for quite some time. I am getting the following error when I call mysql_server_init() ... Unhandled Exception: System.AcessViolationException: Attempted to read or write protected memory. The C++ method takes an int and two char** as parameters, but I was told a null terminated string[] array would suffice in C#. As this is the first method that you're