Questions tagged [unmanaged]

Unmanaged refers to Windows code that is independent of the Common Language Runtime(CLR). COM components, ActiveX components, and Win32 API functions are examples of unmanaged code.

1488 questions
42
votes
7 answers

Is there a tool that generates P/Invoke signatures for arbitrary unmanaged DLL?

I stumbled upon a tool that generates P/Invoke signatures for Microsoft's own unmanaged DLLs: PInvoke Interop Assistant Is there a similar tool that will generate P/Invoke signatures for third-party unmanaged DLLs? Alternately, any way to feed a…
GregC
  • 7,737
  • 2
  • 53
  • 67
35
votes
5 answers

Is it possible to catch an access violation exception in .NET?

Is there anything I can do to catch an AccessViolationException? It is being thrown by a unmanaged DLL that I don't control.
Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447
33
votes
5 answers

C++/CLI Support in .Net Core

Our project structure is like, native.dll :- This contains pure native code written in c\c++. This native.dll exposes some functions using *def file. Wrapper Library(wrapper.dll compiled with .Net framework v4.0) :- In order to use functionality…
User1234
  • 1,543
  • 4
  • 22
  • 32
33
votes
3 answers

Marshal.AllocHGlobal VS Marshal.AllocCoTaskMem, Marshal.SizeOf VS sizeof()

I have the following struct: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WAVEHDR { internal IntPtr lpData; // pointer to locked data buffer internal uint dwBufferLength; // length of data buffer internal…
DxCK
  • 4,402
  • 7
  • 50
  • 89
28
votes
5 answers

What exactly happens during a "managed-to-native transition"?

I understand that the CLR needs to do marshaling in some cases, but let's say I have: using System.Runtime.InteropServices; using System.Security; [SuppressUnmanagedCodeSecurity] static class Program { [DllImport("kernel32.dll", SetLastError…
user541686
  • 205,094
  • 128
  • 528
  • 886
27
votes
6 answers

Where to place dlls for unmanaged libraries?

I am trying to create a Nuget package for a library that depends on ghostscript and therefore references gsdll32.dll - an unmanaged library. I can't just included that a standard dll reference. Where do I put this in the nuget directory structure?
George Mauer
  • 117,483
  • 131
  • 382
  • 612
26
votes
2 answers

Difference between managed and unmanaged in-app product android?

I went through the developer forum to know the difference between managed an unmanaged in-app products. they are saying that "Items that are unmanaged do not have their transaction information stored on Android Market, which means you cannot query…
Andro Dev
  • 395
  • 1
  • 4
  • 14
25
votes
3 answers

What are the implications of using unsafe code

Aside from the fact that the code itself can access memory directly. What are the other implications of using the "/unsafe" compiler flag and the "fixed" keyword? Are there any knock on effects related to code signing and deployment of my .exe (my…
Matt Warren
  • 10,279
  • 7
  • 48
  • 63
25
votes
4 answers

allocating "unmanaged" memory in c#

I'm writting a program in c# that uses a C++ library, and for some reason I need to allocate an unmanaged buffer to pass it to the lib. Is there a way to do this in c# ? Basically I would just need to do a malloc in C#... Thanks
Blitzz
  • 735
  • 2
  • 7
  • 7
24
votes
4 answers

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

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…
chrmue
  • 1,552
  • 2
  • 18
  • 35
23
votes
5 answers

How to analyze memory usage in windbg

This is a .NET v4 windows service application running on a x64 machine. At some point after days of running steadily the windows service memory consumption spikes up like crazy until it crashes. I was able to catch it at 1.2 GB and capture a memory…
Mark
  • 5,223
  • 11
  • 51
  • 81
23
votes
6 answers

Which one to use: Managed vs. NonManaged hashing algorithms

In a regular C# application which class to use for hashing: xxxManaged or xxx (i.e SHA1Managed vs SHA1) and why?
Xaqron
  • 29,931
  • 42
  • 140
  • 205
23
votes
3 answers

Is this DLL managed or unmanaged?

I hold before you a DLL. Using only the Win32 SDK, can you tell me if this DLL is a .NET assembly? Why? Our application loads plugins in the form of DLLs. We are trying to extend the definition of these plugins to allow for .NET assemblies but the…
Charles
  • 2,642
  • 3
  • 33
  • 53
22
votes
6 answers

Unload a .NET DLL from an unmanaged process

I'm extending my Inno-Setup script with code that I can best implement in C# in a managed DLL. I already know how to export methods from a managed DLL as functions for use in an unmanaged process. It can be done by IL weaving, and there are tools to…
ygoe
  • 18,655
  • 23
  • 113
  • 210
22
votes
6 answers

How to call managed code from unmanaged code?

I want to call my .NET code from unmanaged C++. My process entrypoint is .NET based, so I don't have to worry about hosting the CLR. I know it can be done using COM wrappers for .NET objects, but I would like to access individual static methods of…
Hanan
  • 1,395
  • 4
  • 18
  • 29