managed

Mixed management in C++

风流意气都作罢 提交于 2019-12-12 09:43:26
问题 I have added a class to my program and tested it. I was really surprised that there was any real errors. Here is the code: #pragma once #include "Iingredient.h" #include <string> #include <vector> using namespace std; ref class Recipe{ private: string partsName; vector<Iingredient> ing; public: Recipe(){} }; And here are the errors: Error 23 error C4368: cannot define 'partsName' as a member of managed 'Recipe': mixed types are not supported c:\users\user\documents\visual studio 2010\projects

How do I combine an unmanaged dll and a managed assembly into one file?

旧巷老猫 提交于 2019-12-12 09:38:10
问题 SQLite from PHX Software has combined a managed assembly (System.Data.SQLite) with an unmanaged dll (the SQLite 32- or 64-bit dll) into one file, and managed to link them together. How do I do this? Do I need to embed the managed assembly into the unmanaged dll, or vice versa? ie. my questions are: In which order do I need to do this? What tools or knowledge do I need in order to do this? How (if different) do I link to the exported functions from the unmanaged dll in my managed code? The

Best method of calling managed code(c#) from unmanaged C++

混江龙づ霸主 提交于 2019-12-12 08:55:00
问题 We have developed a s/w architecture consisting of set of objects developed in C#. They make extensive use of events to notify the client of changes in status, etc. The intention originally was to allow legacy code to use these managed objects through COM interop services. That was easy to write in the design specification but, I'm seeing that actually implementing it is more problematic. I've searched for many hours looking for a good sample of event handling using this method. Before we

Managed DLL Method failing in installshield

一笑奈何 提交于 2019-12-12 04:23:07
问题 Ok, so I have the following class library, which I wrote in C#: public class Program { public void GetProductID(string location, out string productId) { ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Product"); ManagementObjectCollection collection = searcher.Get(); var item = new Win32Product(); //var crap = (collection as IEnumerable<ManagementObject>).Where(o => o["InstallLocation"].ToString().StartsWith(location)); foreach (ManagementObject obj in

Identifying a process or a module as managed/native [duplicate]

五迷三道 提交于 2019-12-12 03:05:01
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: How do I determine if a Process is Managed in C#? How can I know if a process or a module is managed (.NET) or native programmatically (in C++)? 回答1: I don't have the PE spec handy - you can download it from msdn.com - but a managed module will typically have a CLR header and imports mscoree.dll. 来源: https://stackoverflow.com/questions/7880606/identifying-a-process-or-a-module-as-managed-native

Unexpected Stackoverflow exception using CLR in a dll

点点圈 提交于 2019-12-12 01:48:35
问题 I have a software that accepts a C dll as plugin. The dll export two functions: init and quit. To test how the plugin works, I wrote three projects after the NativeWrapper concept: a managed library in C++ (dll), a native wrapper in C++ (also dll, that exports the init and quit functions) and a C++ test program. For now I am just testing the init function. All these are built and run inside VS 2013 without any issue. However, When I plug the two dlls in with the said software, it stops

iTextSharp .Net DLL included as “embedded resource” does not work

怎甘沉沦 提交于 2019-12-11 18:14:35
问题 I followed the instructions at VB.NET embedded DLL in another DLL as embedded resource? to implement three dlls as embedded resource in my VB.NET project. Two dlls are made with 100% managed code, they are loaded at runtime and work perfectly, however only "iTextSharp.dll" (http://sourceforge.net/projects/itextsharp/) does not load when requested from the assembly, besides I don't know if it's a managed DLL or not. Any suggestion will be very appreciated. 来源: https://stackoverflow.com

Memory leaks? in passing IEnumerable<byte[]> array to unmanaged function as byte** parameter

不打扰是莪最后的温柔 提交于 2019-12-11 15:08:51
问题 Is that the correct way to allocate and free handles to managed data passed to unmanaged dll? There is unmanaged dll with exported function void Function(byte** ppData, int N); I need to pass it IEnumerable<byte[]> afids var handles = afids.Select(afid => GCHandle.Alloc(afid, GCHandleType.Pinned)); var ptrs = handles.Select(h => h.AddrOfPinnedObject()); IntPtr[] afidPtrs = ptrs.ToArray(); uint N = (uint)afidPtrs.Length; Function(afidPtrs, N); handles.ToList().ForEach(h => h.Free()); I get

Wrapping unmanaged c++ in a managed wrapper

橙三吉。 提交于 2019-12-11 10:32:04
问题 I have an unmanaged C++ library. I would like to expose the functionality for .NET applications. There's one partucular function I am not sure how to handle: typedef void (free_fn*) (void*); void put (void *data, free_fn deallocation_function); The idea is that you pass dynamically allocated buffer to the function and supply a deallocation function. The library will process the data asynchronously and will release the buffer later on when data is no longer needed: void *p = malloc (100); ...

Conversion between managed and unmanaged types in C++?

我怕爱的太早我们不能终老 提交于 2019-12-11 09:07:16
问题 When I use a GUI in C++ the text fields are stored as managed strings, i think. I need a way to convert them to standard ints, floats and strings. Any help? 回答1: You can convert a System.String into an unmanaged char * using Marshal.StringToHGlobalAnsi. Make sure you free it when you're done by calling Marshal.FreeHGlobal. To convert the strings to numeric values, you can use the regular .NET parsing functions such as Int32.Parse . 回答2: To use managed memory in native code, you must copy the