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.
Questions tagged [unmanaged]
1488 questions
11
votes
2 answers
Any difference between malloc and Marshal.AllocHGlobal?
I write a module in C# that exports some functions to be used in C.
I need to allocate some memory for some structs to be passed between C <-> C#.
What I allocate in C I do with malloc, and in C# I do with Marshal.AllocHGlobal() (to allocate…

bzamfir
- 4,698
- 10
- 54
- 89
11
votes
0 answers
Safely use SuppressUnmanagedCodeSecurity
I'm currently creating a managed wrapper to an unmanaged dll. Point is the wrapper does a TON of calls to the unmanaged dll but exports very few methods itself.
From the research I did this should be safe but I want to make sure I get this…

user836755
- 111
- 1
- 4
11
votes
1 answer
How to send a string by reference to an unmanaged C library that modifies that string?
I am new to the world of interacting with unmanaged libraries. I have an unmanaged C function that modifies a string by reference within the function. I'm having trouble passing a string from C# and getting it modified by the C function.
Here's the…

Donnie
- 113
- 2
- 5
11
votes
1 answer
C++: Getting the c3859 error code while compiling in a mix of C++/CLI and C++
After I have done as suggested by Hans Passant in C++: Getting the "error C2065: 'pst' : undeclared identifier" while using pstsdk? (which works), my code now looks like this:
private:
System::Void readPstFileButton_Click(System::Object^ …

Will Marcouiller
- 23,773
- 22
- 96
- 162
11
votes
3 answers
No functions in C# DLL with RGiesecke.DllExport
I am trying to make a DLL in C# for use in a couple other languages. I found RGiesecke's DllExport but it doesn't seem to work. It builds just fine and makes a dll, but when I open it in Dependency Walker it doesn't show any functions, and my…

runfastman
- 927
- 2
- 11
- 31
11
votes
9 answers
Performance of Managed C++ Vs UnManaged/native C++
I am writing a very high performance application that handles and processes hundreds of events every millisecond.
Is Unmanaged C++ faster than managed c++? and why?
Managed C++ deals with CLR instead of OS and CLR takes care of memory management,…

bsobaid
- 955
- 1
- 16
- 36
11
votes
2 answers
C# "Unmanaged Exports"
I've been trying to use the extension "Unmanaged Exports" by Robert Giesecke in a Visual Studio 2010 pro/C# project. Yet, I can't make it work - when I check the compiled DLL for exports, the viewer…

user2489608
- 119
- 1
- 1
- 3
11
votes
1 answer
Using C# extension methods from managed C++/CLI
Forgive me if my terminology is a little off. My knowledge of managed C++/CLI is very limited.
I have an MFC application that uses a dll with the /clr option enabled. This dll uses a couple of C# dlls to communicate with a server using WCF. For…

Matt Davis
- 45,297
- 16
- 93
- 124
10
votes
4 answers
What does the class name ending "Managed" mean (C# .NET)?
I'm relatively new to C# so please bear with me. I understand the basic difference between managed and unmanaged code. But I'm still a bit confused when to use some methods.
For instance what does the word "Managed" mean in some class name endings.…

Ben
- 2,435
- 6
- 43
- 57
10
votes
2 answers
C# marshal unmanaged pointer return type
I have an unmanaged library which has a function like this:
type* foo();
foo basically allocates an instance of the unmanaged type on the managed heap through Marshal.AllocHGlobal.
I have a managed version of type. It's not blittable but I have…

Jay Lemmon
- 1,158
- 1
- 8
- 22
10
votes
1 answer
Return unsafe pointer to type parameter
I am trying to define a property that returns a pointer to a generic type argument like so:
public class MemWrapper where T: struct
{
readonly IntPtr pointerToUnmanagedHeapMem;
// ... do some memory management also ...
public unsafe…

oliver
- 2,771
- 15
- 32
10
votes
1 answer
What is the effect of setting (or not) .NET CLR version in ASP.Net Core?
What is the point of setting "No Managed Code" .NET CLR version for an IIS Asp.NET Core application pool?
Documentation says that
ASP.NET Core runs in a separate process and manages the runtime.
ASP.NET Core doesn't rely on loading the desktop…

natenho
- 5,231
- 4
- 27
- 52
10
votes
6 answers
C# deallocate memory referenced by IntPtr
I am using some unmanaged code that is returning pointers (IntPtr) to large image objects. I use the references but after I am finished with the images, I need to free that memory referenced by the pointers. Currently, the only thing that frees…

Dave
- 1,721
- 2
- 23
- 46
10
votes
1 answer
Dynamic Assembly Loading in .Net 4.0
My problem begins with moving a .Net 2.0 application to .Net 4.0. The reason I had to do this was that Windows 8 does not enable the earlier .Net versions by default and my application cannot ask the user to enable it.
The application is a NPAPI…

Isuru
- 594
- 1
- 5
- 19
10
votes
2 answers
C# -- Create Managed Array from Pointer
I'm trying to create a Managed Array of doubles from an array of bytes. I have the problem working currently, but I wanted to optimize. Here's some code that I would like to work:
private unsafe static double[] _Get_Doubles(byte[] _raw_data)
{
…

lmat - Reinstate Monica
- 7,289
- 6
- 48
- 62