managed

How do I change the lookup path for .NET libraries referenced via #using in Managed C++?

孤街浪徒 提交于 2020-01-14 04:00:12
问题 I developed a DLL in Managed C++ which loads some plugins (implemented in any .NET language) at runtime using System.Reflection.Assembly.LoadFile. The interface which is implemented by all plugins is implemented in C#. It's used by the Managed C++ code like this: #using <IMyPluginInterface.dll> // Make the 'IMyPluginInterface' type available ref class PluginManager { List<IMyPluginInterface ^> ^m_plugins; // Load all plugins in a well-known directory. void load() { for ( string dllFile in

LNK2028 Managed C++ DLL calling function in another Managed C++ DLL

二次信任 提交于 2020-01-13 06:36:09
问题 I'm using VS2010 with a managed C++ DLL calling a function in another managed C++ DLL and I'm getting many LNK2028 link errors that look like this. 1>udpPkt.obj : error LNK2028: unresolved token (0A0000AA) "unsigned short __cdecl ComputeCrc16(void const *,unsigned int)" (?ComputeCrc16@@$$FYAGPBXI@Z) referenced in function "public: short __thiscall CPrivateUdpPkt::ComputeCrc(void)const " (?ComputeCrc@CPrivateUdpPkt@@$$FQBEFXZ) When I use dumpbin /export on the called DLL I see the unresolved

How does one Create Managed C++ Static Library in Visual Studio (Error C1189)

老子叫甜甜 提交于 2020-01-07 02:17:05
问题 It seems it is not possible to create a static linked library in managed /CLR generated code. I started by creating a C++ /CLR Library which defaulted to a DLL Library. When I change it to Static library (.lib) I get the error: C1189 "Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]" I don't want to include MFC DLL. I have selected Use Standard Windows Libraries so not sure why it thinks I am building MFC

Using unmanaged pointer to callback function on managed C++

元气小坏坏 提交于 2020-01-06 07:08:10
问题 I am writing C++/CLI a wrapper for some C++ libraries (static .lib, no source code available) controlling Digital I/O pins on an industrial computer. My objective is to handle the events of the DIO pins on an existing C# application using .NET CLR. The only viable option I could think of is to use a delegate in C++/CLI to fire events when the pin state changes (informed by the existing lib), and then handle these events in the C# part. I have tried the basic functionality using simpler mock

C# Can't reflect into private field

柔情痞子 提交于 2020-01-06 05:25:50
问题 I got an issue. In Unity I want to reflect into a private field. But I always get null for the fieldinfo. what am I doing wrong? public abstract class _SerializableType { [SerializeField] private string name; } // because I am using a CustomPropertyDrawer for all inherited from _SerializeType public class SerializableType<T> : _SerializableType { } public class SerializableType : _SerializableType { } [Serializable] public class CTech : SerializableType<_CouplingTechnology> { } so using this

EWS Managed API: Fetch emails by search filter on DateTimeReceived

吃可爱长大的小学妹 提交于 2020-01-06 02:42:06
问题 While searching for items in the inbox that have been received after a particular time frame (as mentioned in the code below). It searches for the date but it is also returning the email with the specified timestamp. I want the emails only after the specified timestamp. SearchFilter greaterthanfilter = new SearchFilter.IsGreaterThan(ItemSchema.DateTimeReceived, Convert.ToDateTime(lastUploadedEmailtimeStamp)); mailItems = inbox.FindItems(greaterthanfilter, view); Not sure if anyone has faced

Stuck on calling convention calling Managed CLI method from unmanaged C++

让人想犯罪 __ 提交于 2020-01-04 09:38:10
问题 I am trying to call a managed method from unmanaged code. However, the managed code is requiring that I use the '(__clrcall) calling convention, and my unmanaged C++ code refuses to let me use the __clrcall calling convention without using the /clr option. I don't believe I want to do that as the unmanaged project is not mine to change to managed. I have gone through constructing all those delegates and function pointer marshaling in the managed side as I have seen on CodeGuru and MSDN but

Where variables of a function is store? on stack or heap?

若如初见. 提交于 2020-01-03 04:15:29
问题 When a program calls a function, in which type of data structure is memory allocated for the variables in that function? Heap or stack? why? In my opinion it should store on stack because they are not necessarily reference types. But Where I read the answer, it is stated that they store on heap and free after function returns a value. 回答1: It is a little more complicated than that and the fact that the stack and heap are used are really implementation details. It makes more sense to talk

Loader lock (regsvr32 R6033 error) with managed C++ dll

老子叫甜甜 提交于 2020-01-01 15:04:14
问题 I have a C++ dll which implements several COM interfaces, that I'm trying to migrate to managed C++. I set the /clr compiler flag and changed the Runtime Library property from /MT to /MD to avoid the conflict between these two flags, but that's all I've changed. When it attempts to register the dll during the build process, I get the following error: R6033 - Attempt to use MSIL code from this assembly during native code initialization This indicates a bug in your application. It is most

Which one to use: Managed vs. NonManaged hashing algorithms

和自甴很熟 提交于 2019-12-30 03:50:08
问题 In a regular C# application which class to use for hashing: xxxManaged or xxx (i.e SHA1Managed vs SHA1 ) and why? 回答1: The Non-managed hashes which end in ***Cng , ie SHA256Cng, will also have platform restrictions. They are quite a bit faster than the managed alternatives, but will fail at runtime on Windows XP, for example. If you know your program will always be run on Windows 7, Vista SP1, or 2008, however, they will generally perform quite a bit better than the managed versions, even