-
September 4th, 2018, 12:27 AM
#1
C++ .Net Managed Pointers, References, vs. original Pointers, References.
-If I am programming in C++ .NET in Visual Studio on Windows 10 64 bit,
and I am submitting method/function parameters to a class that uses
original C++ pointers and references, however if my parameters
are declared and happen to be in the type of C++ .NET
managed pointers (^) and managed references (%),
do I have to convert my old style pointers and references first?
Or can I just submit managed pointers and references and rely
on some form of autoboxing/auto un-boxing for the managed
pointer or managed reference, "type" information?
-Correspondingly, if I use a C++ .net reference class that
has its method parameters declared as
managed pointers (^) and managed references (%), is
there a compiled way to tell the .net runtime not not manage
pointers, references or reference classes, even ones that are declared
requiring so?
-
September 4th, 2018, 01:12 AM
#2
Re: C++ .Net Managed Pointers, References, vs. original Pointers, References.
Teaching someone C++/CLI at a forum is too tedious.
If you're serious about the language you need to learn it from the ground up. A good place to start is the initial design rationale by Sutter,
http://www.gotw.ca/publications/C++CLIRationale.pdf
There are also a few books about the language.
Good luck!
-
September 4th, 2018, 01:28 AM
#3
Re: C++ .Net Managed Pointers, References, vs. original Pointers, References.
Your assemblies need to expose classes and methods that conform to the CLI spec if you expect your c++ .net assemblies to be callable by other .net assemblies. What you do internally is up to you.
-
September 4th, 2018, 02:47 AM
#4
Re: C++ .Net Managed Pointers, References, vs. original Pointers, References.
Is there someone who could at least resond to my parameters questions, though, at least?
-
September 4th, 2018, 03:57 AM
#5
Re: C++ .Net Managed Pointers, References, vs. original Pointers, References.
Originally Posted by Zachary1234
Is there someone who could at least resond to my parameters questions, though, at least?
Arjay already did it in the post#3.
Victor Nijegorodov
-
September 5th, 2018, 10:33 PM
#6
Re: C++ .Net Managed Pointers, References, vs. original Pointers, References.
-For the sake of the included C++.net supplied library code, in terms of constructor parameters
or function parameters, that require parameters to be managed pointers and references,
and not ordinary ones, is there a onetime option to tell the runtime to ignore managed pointers
and references, (^), (%) and gcnew?
Even inside compiler library code, or any compiled code which is invoked
beyond being coded and compiled, after the fact?
-
September 5th, 2018, 11:05 PM
#7
Re: C++ .Net Managed Pointers, References, vs. original Pointers, References.
Not sure what you are asking. The only reason to use managed c++ is to access a feature that is only available in .net or if you are writing an assembly that accesses c/c++ dlls but needs to be exposed as a .net assembly. If you aren't doing either of those things, use native c/c++.
-
September 6th, 2018, 01:46 AM
#8
Re: C++ .Net Managed Pointers, References, vs. original Pointers, References.
Microsoft .net includes a whole bunch of classes to be used with C++. These include
domr mathematics, 2d user interface, basic audio, 2d graphics, threads, printing, and some encryption
support.
Do the constructors and method calls in any of these (included) basis classes require managed pointers and not
ordinary ones? Do any of them require managed references and not ordinary references?
Is there a keyword on an option I can tell the compiler to ignored managed pointers
and reference syntax, and to default back to just treating them as ordinary ones,
everywhere that they occur in my code, or in included code that is compiled already?
-
September 6th, 2018, 02:22 AM
#9
Re: C++ .Net Managed Pointers, References, vs. original Pointers, References.
Originally Posted by Zachary1234
Do the constructors and method calls in any of these (included) basis classes require managed pointers and not
ordinary ones? Do any of them require managed references and not ordinary references?
Why not just read the documentation about library, interface and so on you are going to use?
Victor Nijegorodov
-
September 6th, 2018, 04:29 AM
#10
Re: C++ .Net Managed Pointers, References, vs. original Pointers, References.
I have been doing so, but can't find particular answers on these few questions.
The other thing is that I'm not sure if autoboxing and or auto unboxing occurs before
or after constructors or interfaces in C++. I can't find answers that hit my
pointer/reference/mode questions on the head. Help, anybody, please?
-
September 6th, 2018, 10:46 AM
#11
Re: C++ .Net Managed Pointers, References, vs. original Pointers, References.
Originally Posted by Zachary1234
Microsoft .net includes a whole bunch of classes to be used with C++. These include
domr mathematics, 2d user interface, basic audio, 2d graphics, threads, printing, and some encryption
support.
Do the constructors and method calls in any of these (included) basis classes require managed pointers and not
ordinary ones? Do any of them require managed references and not ordinary references?
Is there a keyword on an option I can tell the compiler to ignored managed pointers
and reference syntax, and to default back to just treating them as ordinary ones,
everywhere that they occur in my code, or in included code that is compiled already?
.NET supports multiple languages through the Common Language Infrastructure specification. Assemblies that are part of the .NET framework are CLI compliant so that any assembly can be called by any language regardless of the language it was written in. Given that, the answer to your question is "no", as all public methods of documented assemblies must be CLI compliant.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|