473,803 Members | 3,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(.NE T)?

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

Have an application developed with Windows Forms Application(.NE T) 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(exe cution
speed) if you compare between an MFC application using C++ and an Windows
Forms Application(.NE T) also using C++?

Is it possible to say anything about the speed of the application(exe cution
speed) if you compare between an MFC application using C++ and an Windows
Forms Application(.NE T) insted using C#?
//Tony
Nov 17 '05 #1
5 1283
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(.NE T)?
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. Interoperabilit y 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(.NE T)?
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(.NE T) 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(exe cution speed) if you compare between an MFC application
using C++ and an Windows Forms Application(.NE T) 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(exe cution speed) if you compare between an MFC application
using C++ and an Windows Forms Application(.NE T) 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.publi c.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(.NE T 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*********@ho tmail.com> skrev i meddelandet
news:eB******** ******@tk2msftn gp13.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(.NE T)?


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. Interoperabilit y 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(.NE T)?


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(.NE T) 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(exe cution speed) if you compare between an MFC application
using C++ and an Windows Forms Application(.NE T) 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(exe cution speed) if you compare between an MFC application
using C++ and an Windows Forms Application(.NE T) 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.publi c.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(.NE T 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 "Generation s". The .NET GC is a "generation al 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.Dis pose. 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(.NE T)?

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


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

You mentioned that you don´t need to care about memory management in
Windows Forms Application(.NE T 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 "Generation s". The .NET GC is a "generation al 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.Dis pose. 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******** *************@n ewsc.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(.NE T)?
It makes no difference.
Can you use Windows Forms Application(.NE T) 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
2015
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 I'm not sure are specific anomolies that I'm having, or if they are specific known issues I'm facing. 1. In VB.NET, are arrays stored on the stack or the heap? Why must arrays of value types be boxed in order for them to be (effectively) passed by...
12
2335
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. These are some questions:- 7. design and implement a class binsearch for a binary search tree.it includes search,remove and add options.make suitable assumption. 8.explai how pointers to functions can be declared in c++.under what conditions can...
1
1817
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 know that an abstract class doesn't have any implementaion even if a default implementatiion can be supplied for pure virtual methods. What does it actually mean with saying that an Abstract superclasses define a behavioral pattern?
162
14933
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 choice questions.etc.. I'll be indebted to everyone.. Thanks in advance.. regards vasant shetty Bangalore
50
4382
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 internals? Q1 . What is the use of pointer to an array? Q2 . What is the use of array of pointers? Q3 . What is the use of pointer to function ? Q4 . How to print through serial port? What is Flow Control(Xon,Xoff) ?
24
1722
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 much larger list of people (for all of us to benefit). I have found it to be an invaluable resource to answer those hard or weird programming questions that come up. If you are interested, please reply, or send me an email at imgroup@gmail.com
7
2360
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! Tony
3
1641
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
1591
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 be asked ?) Is there a site that has some questions & answers ? Thanks :)
30
2299
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/ Unix or C under windows/ DOS ?
0
9564
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10546
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7603
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6841
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.