April 2003 - Posts

PreserveSig
For managed signatures that represent unmanaged functions, the PreserveSig pseudo custom attribute controls an important aspect of run-time behavior. In COM Interop scenarios, a C# method defined as follows: string GetName(); is treated like the following Read More...
Posted 30 April 03 08:48 by Adam Nathan | 4 Comments   
Filed under
Pseudo custom attributes
Tomorrow I'd like to talk about the PreserveSig pseudo custom attribute, but first I thought I'd briefly point out the difference between pseudo custom attributes and "real" custom attributes. The CLR/.NET Framework has a handful of pseudo custom attributes Read More...
Posted 29 April 03 02:46 by Adam Nathan | 5 Comments   
Filed under
GetLastError and managed code
In the Win32 world, calling the GetLastError API is often the mechanism to get additional error information when an API call fails. When calling these same Win32 APIs in managed code via PInvoke or via "It Just Works (IJW)" in managed C++, the rules are Read More...
Posted 25 April 03 03:00 by Adam Nathan | 3 Comments   
Filed under
UnmanagedType.Struct and VARIANT marshaling
Continuing yesterday's theme of marshaling directives, today I'll talk about UnmanagedType.Struct, another poorly-named (and therefore confusing) enumeration value. If you pretend that it's called "UnmanagedType.Variant," it should make more sense. This Read More...
Posted 24 April 03 10:43 by Adam Nathan | 1 Comments   
Filed under
The confusing UnmanagedType.LPStruct marshaling directive
MarshalAsAttribute controls marshaling behavior for managed data types that can have multiple unmanaged representations. Often, the challenge of using MarshalAsAttribute is choosing the right value from the UnmanagedType enumeration to pass to the attribute's Read More...
Posted 23 April 03 08:39 by Adam Nathan | 9 Comments   
Filed under
Page view tracker