unmanaged

Howto implement callback interface from unmanaged DLL to .net app?

醉酒当歌 提交于 2019-11-26 06:36:53
问题 in my next project I want to implement a GUI for already existing code in C++. My plan is to wrap the C++ part in a DLL and to implement the GUI in C#. My problem is that I don\'t know how to implement a callback from the unmanaged DLL into the manged C# code. I\'ve already done some development in C# but the interfacing between managed and unmanaged code is new to me. Can anybody give me some hints or reading tips or a simple example to start from? Unfortunatly I could not find anything

Unmanaged DLLs fail to load on ASP.NET server

拟墨画扇 提交于 2019-11-26 06:21:43
问题 This question relates to an ASP.NET website, originally developed in VS 2005 and now in VS 2008. This website uses two unmanaged external DLLs which are not .NET and I do not have the source code to compile them and have to use them as is. This website runs fine from within Visual Studio, locating and accessing these external DLLs correctly. However, when the website is published on a webserver (runnning IIS6 and ASP.NET 2.0) rather than the development PC it cannot locate and access these

Embedding unmanaged dll into a managed C# dll

二次信任 提交于 2019-11-26 06:08:18
I have a managed C# dll that uses an unmanaged C++ dll using DLLImport. All is working great. However, I want to embed that unmanaged DLL inside my managed DLL as explain by Microsoft there: http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.dllimportattribute.aspx So I added the unmanaged dll file to my managed dll project, set the property to 'Embedded Resource' and modify the DLLImport to something like: [DllImport("Unmanaged Driver.dll, Wrapper Engine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", CallingConvention = CallingConvention.Winapi

Using C++ Class DLL in C# Application

这一生的挚爱 提交于 2019-11-26 05:51:37
问题 I have an unmanaged C++ DLL which merely exports a single class (not COM...it\'s just a simple C++ class) as its interface. I want to use this class in C# but am told that it cannot merely be imported into C#. What is the right way to use this class in my C# application? 回答1: Simple way assuming class Foo: Create a C++/CLI project, call this FooWrapper. Make FooWrapper depend on the unmanaged dll (however you normally would). Create a managed class ManagedFoo which contains a single private

A call to PInvoke function '[…]' has unbalanced the stack

僤鯓⒐⒋嵵緔 提交于 2019-11-26 04:48:55
问题 I\'m getting this weird error on some stuff I\'ve been using for quite a while. It may be a new thing in Visual Studio 2010 but I\'m not sure. I\'m trying to call a unamanged function written in C++ from C#. From what I\'ve read on the internet and the error message itself it\'s got something to do with the fact that the signature in my C# file is not the same as the one from C++ but I really can\'t see it. First of all this is my unamanged function below: TEngine GCreateEngine(int width,int

Embedding unmanaged dll into a managed C# dll

荒凉一梦 提交于 2019-11-26 03:26:02
问题 I have a managed C# dll that uses an unmanaged C++ dll using DLLImport. All is working great. However, I want to embed that unmanaged DLL inside my managed DLL as explain by Microsoft there: http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.dllimportattribute.aspx So I added the unmanaged dll file to my managed dll project, set the property to \'Embedded Resource\' and modify the DLLImport to something like: [DllImport(\"Unmanaged Driver.dll, Wrapper

Difference between “managed” and “unmanaged”

时光怂恿深爱的人放手 提交于 2019-11-26 03:04:21
问题 I hear/read about it sometimes when talking about .NET, for example \"managed code\" and \"unmanaged code\" but I have no idea what they are and what are their differences. What are their difference, by definition? What are the consequences of using either of them? Does this distinction exist in .NET/Windows only? 回答1: Managed Code Managed code is what Visual Basic .NET and C# compilers create. It runs on the CLR (Common Language Runtime), which, among other things, offers services like

What is managed or unmanaged code in programming?

不想你离开。 提交于 2019-11-26 02:41:34
问题 I am using a specific command in in my C# code, which works well. However, it is said to misbehave in \"unmanaged\" code. What is managed or unmanaged code? 回答1: Here is some text from MSDN about unmanaged code. Some library code needs to call into unmanaged code (for example, native code APIs, such as Win32). Because this means going outside the security perimeter for managed code, due caution is required. Here is some other complimentary explication about Managed code: Code that is executed

Possible to call C++ code from C#?

大兔子大兔子 提交于 2019-11-26 00:36:50
问题 Is it possible to call C++ code, possibly compiled as a code library file (.dll), from within a .NET language such as C#? Specifically, C++ code such as the RakNet networking library. 回答1: One easy way to call into C++ is to create a wrapper assembly in C++/CLI. In C++/CLI you can call into unmanaged code as if you were writing native code, but you can call into C++/CLI code from C# as if it were written in C#. The language was basically designed with interop into existing libraries as its