unmanaged

How to use managed code from unmanaged code?

╄→гoц情女王★ 提交于 2019-11-30 14:51:47
How do I call a .NET code from native C++ (unmanaged code)? I want to expose .NET code to my unmanaged (C++) application and then use them. More specifically, I want to call C# from native C++ :). I know there are many ways but can you tell me the pros and cons of each? By the way, I don't want to use COM so what are the options now? Is it possible that I wrap the C# code in C++/CLI and then call it from C++? If so, how do I do that? How do I wrap the C# in C++/CLI and then call it from C++? Robert Giesecke I've written about it just recently. It was about Delphi, but that doesn't mean it won

What's the difference between a non-unmanaged type and a managed type?

谁都会走 提交于 2019-11-30 12:52:03
问题 When I wrote the following snippet for experimenting purposes, it raised the hover-error (see screenshot): Cannot declare pointer to non-unmanaged type 'dynamic' The snippet: dynamic* pointerToDynamic = &fields; While the code is clearly not allowed (you cannot take the address of a managed type), it raised with me the question: what is a non-unmanaged type and how is it different to a managed type? Or is it just Visual Studio trying to be funny? 回答1: There is a difference between unmanaged

Where does DLLImport look for unmanaged DLLs?

心已入冬 提交于 2019-11-30 12:47:11
A quick question: When declaring the DLLImport Attribute in .Net, where does the runtime look to resolve that DLL dependency? Would I have to dump the DLL and all of its dependencies in the bin folder? Martin I think it is working like LoadLibrary. Maybe Windows path searching in LoadLibrary with manifest will be helpfull. Edit Dynamic-Link Library Search Order is probably what you want. Generally, you'd expect it to look at whatever's defined in the user's Path. To find out what this contains, from a command prompt, type echo %PATH% [Enter] 来源: https://stackoverflow.com/questions/268627/where

Autowiring Unmanaged Beans Annotated With @Component

有些话、适合烂在心里 提交于 2019-11-30 12:18:42
问题 I want to use @AutoWired to inject a non-managed bean configured with @Component into a managed bean. I'm pretty sure I have the configuration right, but for some reason I keep getting the exception: No unique bean of type [foo.Baz] is defined: Unsatisfied dependency of type [class foo.Baz]: expected at least 1 matching bean Based on the error, I'm guessing it's not able to find the Baz class, but I'm not sure why. It's my understanding that the context:spring-configured element in the XML

Is this DLL managed or unmanaged?

▼魔方 西西 提交于 2019-11-30 06:55:33
问题 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 interface will be different and thus the loader will need to know if the DLL is managed or unmanaged before loading it. 回答1: You can check the PE header information for the information about what type of information is contained in the DLL. This

How to generate type library from unmanaged COM dll

南楼画角 提交于 2019-11-30 06:46:54
I have to use third party, unmanaged COM dll into my .NET application. I need to modify this assembly to produce a custom RCW . In order to Edit Interop Assembly I need the type library of the particular assembly. Can any one explain me that how to How to generate type library from unmanaged COM dll? There is no option in regsvr32 to generate type library. Thank you, Best Regards, Robo. If all you're trying to do is create an Interop Assembly from a native dll (and the native DLL embeds the TLB as a resource), you can just call tlbimp directly on the dll: tlbimp Foo.dll /out:Interop.Foo.dll

C# to C++/CLI to C DLL System.IO.FileNotFoundException

一世执手 提交于 2019-11-30 04:02:23
问题 I'm getting System.IO.FileNotFoundException: The specified module could not be found when running C# code that calls a C++/CLI assembly which in turn calls a pure C DLL. It happens as soon as an object is instantiated that calls the pure C DLL functions. BackingStore is pure C. CPPDemoViewModel is C++/CLI calling BackingStore it has a reference to BackingStore. I tried the simplest possible case - add a new C# unit test project that just tries to create an object defined in CPPDemoViewModel .

What's the difference between a non-unmanaged type and a managed type?

自古美人都是妖i 提交于 2019-11-30 03:26:06
When I wrote the following snippet for experimenting purposes, it raised the hover-error (see screenshot): Cannot declare pointer to non-unmanaged type 'dynamic' The snippet: dynamic* pointerToDynamic = &fields; While the code is clearly not allowed (you cannot take the address of a managed type), it raised with me the question: what is a non-unmanaged type and how is it different to a managed type? Or is it just Visual Studio trying to be funny? There is a difference between unmanaged and non-managed pointers. A managed pointer is a handle to an object on the managed heap, and AFAIK is

How to serialize byte array to XML using XmlSerializer in C#?

孤街浪徒 提交于 2019-11-30 01:32:57
问题 Say we have a struct that it's data is provided by un-managed byte array using Marshal.PtrToStructure. The C# struct layout: [StructLayout(LayoutKind.Sequential, Size = 128, CharSet = CharSet.Ansi, Pack = 1)] public struct MNG_Y_Params { public byte Number; public byte Version; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] OliNumber; public byte InterfaceType; } The byte array represent a (ascii) string in the un-managed code. This struct is a member of another struct

Swift (iOS 8 SDK) Convert Unmanaged<ABMultiValueRef> to ABMultiValueRef

依然范特西╮ 提交于 2019-11-30 00:30:56
I need to convert the return value of this function from the AddressBook framework: ABRecordCopyValue(nil, kABPersonPhoneProperty) to a value of type ABMultiValueRef This function is currently marked as this: func ABRecordCopyValue(record: ABRecordRef!, property: ABPropertyID) -> Unmanaged<AnyObject>! So I can convert it to Unmanaged like so: ABRecordCopyValue(person, kABPersonPhoneProperty) as Unmanaged<ABMultiValueRef> But then how can I get it as an ABMultiValueRef so that I can pass it to this function? func ABMultiValueGetIndexForIdentifier(multiValue: ABMultiValueRef!, identifier: