c++-cli

what does the symbol ^% mean in c++ project [duplicate]

天大地大妈咪最大 提交于 2019-12-07 15:15:50
问题 This question already has answers here : What does the C++/CLI Object^% (caret percent-sign) declaration mean? (5 answers) Closed 4 years ago . i have a c# project AAA with the project type “class library", in another c++ project, it add the AAA.DLL in the reference, in the source code void CTest:OnCallback(OperationCallbackInfo^% oci) OperationCallbackInfo is class defined in AAA.dll my question is: what does the symbol ^ and % mean in the parameter? 回答1: It means what you have isn't really

Memory leak in MATLAB > MEX file > managed DLL

若如初见. 提交于 2019-12-07 14:47:28
问题 My MEX file is written in C++/CLI and calls a DLL written in C#. When gcnew'ing an object, shouldn't it be garbage collected when the mexFunction returns? Its references should be lost but nothing seems to be garbage collected... each call to the mex function increases MATLAB's memory allocation (and no, the memory is not used for MATLAB variables). I've experimented with creating a large dummy value with narrow scope and when stepping through the MEX file I can see the memory allocated and

C++/CLI or C# for creating fast, modern and responsive GUI on Windows [closed]

对着背影说爱祢 提交于 2019-12-07 14:28:03
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . Currently I am split between these two languages. I'm almost halfway through programming my current application which needs to be very fast. It calculates insulated glass structures of any kind in multiple load-conditions. I just do not know if its the right choice to write

how to turn C++/CLI .Net socket into boost::asio socket?

╄→гoц情女王★ 提交于 2019-12-07 13:09:02
问题 What I want is simple - code sample of creating new boost asio socket from C++/CLI .Net socket. How to create such thing? Here is pseudo code of what I would like to do: .net::socket a; boost::asio::socket b; b.assign(a.nativeWin32Socket()); 回答1: Have you tried? b.assign(a.Handle.ToInt32()); Also note they you will need to use WSADuplicateSocket as you may get that both b and a will close the socket and point you don't expect. So you need something like: SOCKET native = WSADuplicateSocket(a

c++/cli static constructor of derived class is not called

匆匆过客 提交于 2019-12-07 12:53:33
问题 As described in another SO post of me I saw a strange behaviour of my application after moving from VS 2008 (.net 3.5) to VS 2013 (and using .net 4.0, not 4.5). I found that the static constructor (cctor) of a class was not called any more. Therefore I broke the application down into a small test program: DLLs testAssembly_2-0 and testAssembly_4-0 (similar content; testAssembly_4-0 has names with 40 instead of 20 ) namespace testAssembly_20 { public ref class Class20 { public: Class20 () {

String marshalling with marshal_as and encodings

非 Y 不嫁゛ 提交于 2019-12-07 12:43:36
问题 Converting between String^ and std::string is very easy using marshal_as. However, I have nowhere found a description of how encodings in such a string are handled. String^ uses UTF-16 but what about std::string? Text in that can be interpreted in various ways and it would be very usefull if the marshalling would convert to an encoding that is native to your application. In my case all std::string instances contain UTF-8 encoded text. So how would I tell marshal_as to give me an UTF-8 encoded

Mixing MFC and WPF: Modal Dialogs

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 12:39:14
问题 I'm adding C# WPF dialogs to an existing C++ MFC app, using a C++/CLI interface layer. I've got things working, except I'm having a problem with modality. For example: MFC app shows a WPF dialog using ShowDialog. Works as expected. That WPF dialog shows a MFC dialog using DoModal. The WPF dialog is hidden behind the base C++ app, and is not disabled unless I manually change IsEnabled. Not ideal, but it works. Now, that MFC dialog is closed. Now for some reason the base MFC app is enabled,

Defining a matrix as an array of arrays and computation its inverse matrix in C++

一个人想着一个人 提交于 2019-12-07 11:57:16
问题 Unfortunately I haven't much experience in C++ and I'm trying to progress myself in C++. Firstly,I defined array of arrays so that I formed an 3x3 matrix: array< array< double >^ >^ input = gcnew array< array< double >^ >(3); for (j=0;j<input->Length;j++){ input[j]=gcnew array<double>(3); Then I assigned matrix elements to input array of arrays: int value=1; for(y=0;y<(3);y++){ for(x=0;x<(3);x++) {input[y][x]=value; value=value+1; } } Is there a C++ function that compute inverse matrix of

C++/CLI Wrapping a Function that Returns a std::shared_ptr

坚强是说给别人听的谎言 提交于 2019-12-07 11:55:19
问题 I'm currently wrapping a C++ class with C++/CLI for .NET interoperability following the standard process of holding a native pointer in a managed class. In one instance, I have a native class that has a function like: std::shared_ptr<BaseChannel> channelData(const int RunNumber); I have already begun creating a wrapper class for BaseChannel . However, if I pass the raw pointer to the constructor of the managed class, there are no guarantees on the lifetime of the object being pointed to by

C# SendMessage to C++ WinProc

会有一股神秘感。 提交于 2019-12-07 11:08:53
问题 I need to send a string from C# to a C++ WindowProc. There are a number of related questions on SO related to this, but none of the answers have worked for me. Here's the situation: PInvoke: [DllImport("user32", CharSet = CharSet.Auto)] public extern static int SendMessage(IntPtr hWnd, uint wMsg, IntPtr wParam, string lParam); C#: string lparam = "abc"; NativeMethods.User32.SendMessage(handle, ConnectMsg, IntPtr.Zero, lparam); C++: API LRESULT CALLBACK HookProc (int code, WPARAM wParam,