|
NAVALMAN wrote: Is it depend on my Visual Studio version? No, Visual Studio is an IDE and has nothing to do with the code generation or running of programs.
Use the best guess
|
|
|
|
|
Thanks Richard MacCutchan.
How the pointers are handled in Manged C++?
|
|
|
|
|
What do you mean?Pointers are pointers, nothing more. If you are asking about handing off unmanaged objects to managed code, then you need to look at some of these links[^].
Use the best guess
|
|
|
|
|
NAVALMAN wrote: How C# (managed code) handle the pointers?
Since it is managed C++ it probably doesn't do anything especially clever. If C# is doing anything at all, it is just wrapping it in a small object.
The C# specification might spell it out in detail.
|
|
|
|
|
Thank you
|
|
|
|
|
I have a legacy C++ native code application that implements a class hierachy with some inheritance.
I have to re-implement the application within a managed framework.
TI would like to reuse the unmanged class hierarchy from the managed application and still benefit from the polymorphism built in to my unmanaged class hierarchy.
Do I have to write a C++/CLI wrapper for each unmanaged class in the hierarchy and duplicate the inheritance structure within the wrappers?
|
|
|
|
|
You might do it that way, but it might actually be better to put the native parts into managed DLLs using the wrappers and then using the DLLs from your managed application.
It all depends on what you are trying to do. I wouldn't get too wrapped up in trying to preserve the old hierarchy in the managed world though.
|
|
|
|
|
Assuming that you really do need to expose the full class hierarchy as managed types to managed code then yes, I think you're left duplicating the hierarchy with wrapper ref classes.
If the client managed application is also guaranteed to be C++/CLI (and not C#) it could #include the native class hierarchy intact and use it directly. If you want to allow C# then I'd use wrapper classes with the PIMPL idiom.
Also, hopefully your native classes don't use multiple inheritance since a managed class can only have one non-interface base class.
John
|
|
|
|
|
|
|
Hello!
In my linker I get an error:
[bcc32 Error] Unit1.cpp(109): E2316 'GetScanline' is not a member of 'TBitmapData' Full parser context Unit1.cpp(42): parsing: void _fastcall TForm1::Button1Click(TObject *)
But I can clearly see it here
Embarcadero API TBitmapData
Actually I have only 3 methods in TBitmapData - Pitch, GetPixel and PixelFormat. That is strange.
What should I do to use GetScanline?
I use Embarcadero RAD Studio XE3. And Firemonkey.
Thanks!
|
|
|
|
|
Please post your question (which is not C++/CLI) in one forum only.
Use the best guess
|
|
|
|
|
Sorry. I hurried too much and posted it in the wrong place. Then had to post it where it should be. My bad.
|
|
|
|
|
If you post in the wrong place you can always delete it when you realise your mistake.
Use the best guess
|
|
|
|
|
Hi
my application is in C++ and I need to call a method from application that is in C#
I use Visual Studio 2012 and I am completely new to this.
I tried some of the examples on this site but am frustrated by failure all the time.
I created a C++/CLR project
and used the example at following link, but can't get it to I don't know why it thinks I'm using unmanaged code while I checked the commandline options in my project and there is /clr in it. Is this related VS 2012? please help
http://www.codeproject.com/Articles/10020/Using-managed-code-in-an-unmanaged-application
|
|
|
|
|
Member 9668955 wrote: please help With what? All you have done is tell us that you can't get it to work. You need to provide specific details of the failures and include extracts of the code that is giving the problem. If you are having a problem with the code of an article then you should use the forum at the end of that article to discuss with the author.
Use the best guess
|
|
|
|
|
Dear All Everyone !
If you have book abt VISUAL STUDIO 2005 or 2008, pls send to me with email address: lqlong0302@gmail.com
Thank you very much !
|
|
|
|
|
Greetings All,
I would like to make a GUI, for sensor configuration purpose, with the style of MFC Application Wizard. Basically, I'd like
1. Multiple property sheets, each of which can interact with user inputs.
2. There is a browsing tree to list all the property sheets.
3. One can navigate through the property sheet by "Previous" and "Next" buttons; or, one may select a property sheet by clicking it in the browsing tree.
I program mainly in C++, and know well of VB. I wonder what tool and option would do the trick.
Thanks a lot!
Z.
|
|
|
|
|
|
|
Hi everyone,
I have a string array in C# includes 4 strings:
{"string1", "string2", "string3", "string4"}
In C#, I can use List<string> or string[] to process. But now I want to send this array to a function in C++ (may be is vector<string>).
How can I do that ? and what is the suitable type of string array in C++
Thanks and regards,
Tai
modified 17-Jun-13 0:11am.
|
|
|
|
|
C# string[] becomes array<String^>^ in C++.
List<string> becomes List<String^>^.
Remember you need to allocate managed types with gcnew in C++. (The regular new is for unmanaged types.) The conversion is done automatically on function call. In fact it isn't even a real conversion, as the meaning/memory layout is the same, just the expression looks different. So you declare a function taking a array<String^>^ and pass in a string[] or the other way araound.
Keep in mind, you can't have C# and C++ in the same module (exe/dll) so you need to separate the code into different ones.
|
|
|
|
|
Freak30's answer is good and thinking about it I realize you may want to get the string value to native C++ code instead of just to C++/CLI. If that's the case, you'll want to look into the marshal_as templates.
ex.
#include <msclr\marshal.h>
. . .
const char * message = "test";
String^ managed = marshal_as<String^>( message );
|
|
|
|
|
Thanks Freak30,
I am using Visual Studio 2010. I tried to send string[] in C# to string[] in C++, but not successful
In C#, I used below codes:
[DllImport("DgnShpConverter.dll")]
public static extern Boolean ConvertDgnToShp(string source, string destinationPath, string shpFileName, string [] strArray);
And in C++ (file DgnShpConverter.dll), I used below codes:
__declspec(dllexport) bool ConvertDgnToShp(const char* sourceFile, const char *destinationPath, const char *shpFileName, string myArray[])
{
}
Do you know how to fix this ?
Thanks and kind regards,
Tai
|
|
|
|
|