473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

some .NET questions

Hello!

Is it possible to mix C++ code for example DLL developed with Visual Studio
6.0 with C++ code developed with Windows Forms Application(.NET)?

Is it possible to mix C++ code for example DLL developed with Visual Studio
6.0 with C# code developed with Windows Forms Application(.NET)?

Have an application developed with Windows Forms Application(.NET) any
advantages compared to an
MFC application. The language that have been used is C++?

Is it possible to say anything about the speed of the application(execution
speed) if you compare between an MFC application using C++ and an Windows
Forms Application(.NET) also using C++?

Is it possible to say anything about the speed of the application(execution
speed) if you compare between an MFC application using C++ and an Windows
Forms Application(.NET) insted using C#?
//Tony
Nov 17 '05 #1
5 1249
See inline

Hello!
Hello!
Is it possible to mix C++ code for example DLL developed with Visual
Studio 6.0 with C++ code developed with Windows Forms Application(.NET)?
Yes, it is. You can call VC++6.0 code in, at least, two different ways. You
can build a plain dll exposing C style functions or build a dll exposing COM
object. Interoperability with native code is an importa advantge of VC++.Net
over other .net languages.
Is it possible to mix C++ code for example DLL developed with Visual
Studio 6.0 with C# code developed with Windows Forms Application(.NET)?
Yes, it is. You can use COM Interop (if you are exposing COM object from
C++) or P/Invoke (if you are exposing functions).
Have an application developed with Windows Forms Application(.NET) any
advantages compared to an
MFC application. The language that have been used is C++?
You don´t need to care about memory management, this can or can not be an
advantage.
In my own opinion, WinForms' object mode is more intuitive than MFC's object
model.
If you already know MFC well, you will be more productive in MFC than in
WinForms.
Is it possible to say anything about the speed of the
application(execution speed) if you compare between an MFC application
using C++ and an Windows Forms Application(.NET) also using C++?
MFC would be a little faster, but don't expect a great difference in most of
the applications.
Is it possible to say anything about the speed of the
application(execution speed) if you compare between an MFC application
using C++ and an Windows Forms Application(.NET) insted using C#?


MFC would be a little faster, but don't expect a great difference in most of
the applications.
If you call unmaged code, C++.net will perform better than C#.
--
Un saludo
Rodrigo Corral González [MVP]

FAQ de microsoft.public.es.vc++
http://rcorral.mvps.org
Nov 17 '05 #2
Hello!

You mentioned that you don´t need to care about memory management in Windows
Forms Application(.NET when you use C++, this can or can not be an
advantage.

Do you really mean that you don't have to use the delete to delete
dynamically created object any more?
This mean that there must exist some kind of garbage collector(gc) taking
care of this. Is that right?

As there must exist some kínd of gc this must affect the execution speed as
you also say.
//Tony

"Rodrigo Corral [MVP]" <co*********@hotmail.com> skrev i meddelandet
news:eB**************@tk2msftngp13.phx.gbl...
See inline

Hello!


Hello!
Is it possible to mix C++ code for example DLL developed with Visual
Studio 6.0 with C++ code developed with Windows Forms Application(.NET)?


Yes, it is. You can call VC++6.0 code in, at least, two different ways.
You can build a plain dll exposing C style functions or build a dll
exposing COM object. Interoperability with native code is an importa
advantge of VC++.Net over other .net languages.
Is it possible to mix C++ code for example DLL developed with Visual
Studio 6.0 with C# code developed with Windows Forms Application(.NET)?


Yes, it is. You can use COM Interop (if you are exposing COM object from
C++) or P/Invoke (if you are exposing functions).
Have an application developed with Windows Forms Application(.NET) any
advantages compared to an
MFC application. The language that have been used is C++?


You don´t need to care about memory management, this can or can not be an
advantage.
In my own opinion, WinForms' object mode is more intuitive than MFC's
object model.
If you already know MFC well, you will be more productive in MFC than in
WinForms.
Is it possible to say anything about the speed of the
application(execution speed) if you compare between an MFC application
using C++ and an Windows Forms Application(.NET) also using C++?


MFC would be a little faster, but don't expect a great difference in most
of the applications.
Is it possible to say anything about the speed of the
application(execution speed) if you compare between an MFC application
using C++ and an Windows Forms Application(.NET) insted using C#?


MFC would be a little faster, but don't expect a great difference in most
of the applications.
If you call unmaged code, C++.net will perform better than C#.
--
Un saludo
Rodrigo Corral González [MVP]

FAQ de microsoft.public.es.vc++
http://rcorral.mvps.org

Nov 17 '05 #3
Tony Johansson wrote:
Hello!

You mentioned that you don´t need to care about memory management in
Windows Forms Application(.NET when you use C++, this can or can not
be an advantage.
Actually, you do still have to worry about memory management, you just worry
in a different way, about different details.
Do you really mean that you don't have to use the delete to delete
dynamically created object any more?
Yes.
This mean that there must exist some kind of garbage collector(gc)
taking care of this. Is that right?
Yes.
As there must exist some kínd of gc this must affect the execution
speed as you also say.


Yes. The performance under a GC system is different than a non-GC. The
theorists tell us that the amortized time per allocation with a GC is
substantially less than with a traditional allocator, yet many people will
complain about the performance of GC apps being sluggish.

The main difference is this: Allocation from the collecting memory manager
is lightning fast (can be as fast as a single instruction to allocate a
block of memory). The reclamation speed is orders of matgnitude slower, but
doesn't occur very often (many programs will run to completion without ever
invoking a collect operation). How those facts affect performance depends a
lot on how your application uses memory (and if you ever force a GC
collect - forcing a collect almost never improves performance).

Under a GC system instead of worrying about deleting dynamically allocated
memory, you worry about a couple of other things:

1. GC "Generations". The .NET GC is a "generational collector". When
objects are allocated, they are in Gen 0. When the GC runs, all active
objects in Gen 0 are "promoted" to Gen 1, etc, up to Gen 2 (or 3 generations
total). The cost of collecting Gen1 is potentially orders of magnitude
higher than collecting Gen 0, likewise for Gen 2. So under such a
collector, you worry about causing objects to unnecessarily survive into Gen
1 or Gen 2, and there are specific programming patterns that can be used to
help limit promotion of objects out of Gen 0.

2. Object lifetime. Under C++, an object's lifetime and the lifetime of the
memory it occupies are always the same. Under .NET, this isn't so. Because
objects may never be collected (freed), there has to be another way to
signal the end of the useful lifetime of the object. Under .NET (and Java),
this is done through the IDispose pattern. C++/CLI automates the
IDisposasble pattern so that you can apply the delete operator to a "heap
object" to end it's useful lifetime (but this has nothing to do with the
lifetime of the memory if occupies). C++/CLI also allows you to declare
"stack based" objects that are really proxies for heap-based objects.
Standard C++ destructor semantics are applied to these objects so their
lifetime (but not their memory allocation) ends (by calling Dispose()) when
the block where the object is declared is exited. In fact, under C++/CLI,
the normal C++ destructor is mapped to IDisposable.Dispose. C# provides a
special syntactical structure (a using block) to handle deterministic
destruction - calling Dispose(). It's neat, but you have to remember to do
it. Under C++/CLI, it happens automatically like you've come to expect for
C++ destructors.

You might find these links helpful in understanding C++/CLI and porting your
MFC application to VC 2005. Spend some time searching MSDN, and looking at
articles "near" these in the table of contents - there's lots of information
out there from Microsoft on this topic, you just have to look for it.

http://msdn.microsoft.com/msdnmag/issues/05/02/PureC/
http://msdn.microsoft.com/library/de...BakerDozen.asp
http://msdn.microsoft.com/library/en...asp?frame=true
http://msdn.microsoft.com/library/en...asp?frame=true

-cd
Nov 17 '05 #4
Hello!

If you have an real time application then the execution speed is very
important.
If you use Windows Forms Application(NET) and the execution speed is not
good enough is it then possible to switch off gc and taking care of all
memory managemt itself deleting dynamically created object just to increase
the execution speed? I assume that you can still use the delete statement.

I'm I right if I say the learning curve is much shorter for using Windows
Forms Application(NET) then for MFC?

Which language between C# and C++ have the best execution speed when using
Windows Forms Application(.NET)?

Can you use Windows Forms Application(.NET) in such a way that the execution
speed is more or less the same as MFC?
//Tony


"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
skrev i meddelandet news:Or****************@TK2MSFTNGP14.phx.gbl...
Tony Johansson wrote:
Hello!

You mentioned that you don´t need to care about memory management in
Windows Forms Application(.NET when you use C++, this can or can not
be an advantage.


Actually, you do still have to worry about memory management, you just
worry in a different way, about different details.
Do you really mean that you don't have to use the delete to delete
dynamically created object any more?


Yes.
This mean that there must exist some kind of garbage collector(gc)
taking care of this. Is that right?


Yes.
As there must exist some kínd of gc this must affect the execution
speed as you also say.


Yes. The performance under a GC system is different than a non-GC. The
theorists tell us that the amortized time per allocation with a GC is
substantially less than with a traditional allocator, yet many people will
complain about the performance of GC apps being sluggish.

The main difference is this: Allocation from the collecting memory
manager is lightning fast (can be as fast as a single instruction to
allocate a block of memory). The reclamation speed is orders of
matgnitude slower, but doesn't occur very often (many programs will run to
completion without ever invoking a collect operation). How those facts
affect performance depends a lot on how your application uses memory (and
if you ever force a GC collect - forcing a collect almost never improves
performance).

Under a GC system instead of worrying about deleting dynamically allocated
memory, you worry about a couple of other things:

1. GC "Generations". The .NET GC is a "generational collector". When
objects are allocated, they are in Gen 0. When the GC runs, all active
objects in Gen 0 are "promoted" to Gen 1, etc, up to Gen 2 (or 3
generations total). The cost of collecting Gen1 is potentially orders of
magnitude higher than collecting Gen 0, likewise for Gen 2. So under such
a collector, you worry about causing objects to unnecessarily survive into
Gen 1 or Gen 2, and there are specific programming patterns that can be
used to help limit promotion of objects out of Gen 0.

2. Object lifetime. Under C++, an object's lifetime and the lifetime of
the memory it occupies are always the same. Under .NET, this isn't so.
Because objects may never be collected (freed), there has to be another
way to signal the end of the useful lifetime of the object. Under .NET
(and Java), this is done through the IDispose pattern. C++/CLI automates
the IDisposasble pattern so that you can apply the delete operator to a
"heap object" to end it's useful lifetime (but this has nothing to do with
the lifetime of the memory if occupies). C++/CLI also allows you to
declare "stack based" objects that are really proxies for heap-based
objects. Standard C++ destructor semantics are applied to these objects so
their lifetime (but not their memory allocation) ends (by calling
Dispose()) when the block where the object is declared is exited. In
fact, under C++/CLI, the normal C++ destructor is mapped to
IDisposable.Dispose. C# provides a special syntactical structure (a using
block) to handle deterministic destruction - calling Dispose(). It's
neat, but you have to remember to do it. Under C++/CLI, it happens
automatically like you've come to expect for C++ destructors.

You might find these links helpful in understanding C++/CLI and porting
your MFC application to VC 2005. Spend some time searching MSDN, and
looking at articles "near" these in the table of contents - there's lots
of information out there from Microsoft on this topic, you just have to
look for it.

http://msdn.microsoft.com/msdnmag/issues/05/02/PureC/
http://msdn.microsoft.com/library/de...BakerDozen.asp
http://msdn.microsoft.com/library/en...asp?frame=true
http://msdn.microsoft.com/library/en...asp?frame=true

-cd

Nov 17 '05 #5

"Tony Johansson" <jo*****************@telia.com> wrote in message
news:ZA*********************@newsc.telia.net...
Hello!

If you have an real time application then the execution speed is very
important.
If you use Windows Forms Application(NET) and the execution speed is not
good enough is it then possible to switch off gc and taking care of all
memory managemt itself deleting dynamically created object just to
increase the execution speed? I assume that you can still use the delete
statement.
You cannot disable GC. If you're allocating memory from the managed heap
then you're using GC - it's not optional. You only choice is to not used
managed code (.NET) at all.

I'm I right if I say the learning curve is much shorter for using Windows
Forms Application(NET) then for MFC?
Generally yes, primarily because there's a lot less to WinForms than there
is to MFC. But remember, to use Winforms you first need to get some
familiarity/comfort with the .NET Base Class Libraries (BCL), which
encompass several hundred classes with thousands of properties and methods -
it's still a lot to learn.
Which language between C# and C++ have the best execution speed when using
Windows Forms Application(.NET)?
It makes no difference.
Can you use Windows Forms Application(.NET) in such a way that the
execution speed is more or less the same as MFC?


Since WinForms is built on GDI+, which is in turn a user-mode library built
on top of GDI (and hence has no GPU-hardware acceleration at all), it's very
unlikely that you'll be able to build a winforms GUI of any complexity that
come close to the performance of MFC.

-cd

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ross Micheals | last post by:
All I have some general .NET questions that I'm looking for some help with. Some of these questions (like the first) are ones that I've seen various conflicting information on, or questions that...
12
by: Vibhajha | last post by:
Hi friends, My sister is in great problem , she has this exam of C++ and she is stuck up with some questions, if friends like this group provides some help to her, she will be very grateful....
1
by: Tony Johansson | last post by:
Hello Experts! I have some questions about inheritance that I want to have an answer to. It says "Abstract superclasses define a behavioral pattern without specifying the implementation" I...
162
by: techievasant | last post by:
hello everyone, Iam vasant from India.. I have a test+interview on C /C++ in the coming month so plz help me by giving some resources of FAQS, interview questions, tracky questions, multiple...
50
by: Jatinder | last post by:
I 'm a professional looking for the job.In interview these questions were asked with some others which I answered.But some of them left unanswered.Plz help. Here are some questions on C/C++, OS...
24
by: Kevin | last post by:
Hey guys. I'm looking to get together some VB programmers on Yahoo messenger. I sit at a computer and program all day. I have about 3 or 4 people already, but it would be really cool to have a...
7
by: changs | last post by:
Hi, all I have a asm code, I suspect it sort of socket programming. Can anyone here give some instructions on how to determine the function or give the psudo-code in C? Thanks in advance! ...
3
by: iKiLL | last post by:
Hi all I am building an Windows Mobile 5 forms control in C#, for a Windows Mobile 5 application. I am using CF2.0 and SQL Mobile 2005. The control is a Questions and answer control.
4
by: Mr. X. | last post by:
Hello. I need some help, please. What can an employee ask (technical questions), if I am interviewed of Dot-net developer (also VB.NET and C#). (What are the most general questions, that I may...
30
by: GeorgeRXZ | last post by:
Hi Friends, I have some questions related to C Language. 1What is the difference between the standard C language and Non standard C language ? 2which is better C Lanugage, C under Linux/...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.