473,326 Members | 2,111 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,326 software developers and data experts.

dotnet or MFC

Hi,

I'm starting a new project and am still torn deciding whether to go
with MFC or to do it in C++/CLI with dotnet. The app makes extensive
use of C++ native libraries which cannot go managed (closed source) and
will have a whole pile of UI. Dotnet is way easier for UI than MFC but
it doesn't compile to native. How much of a speed hit is dotnet UI and
converting back and forth between String^ and std::string*? Do the MSIL
obfucsators work at all? Dotnet seems to be a huge memory hog as well
and GC is kind of slow to reclaim memory. Also, the VC2005 built-in
leak detector seems to be missing (my test project is mixed managed and
unmanaged).

Thanks.

Apr 19 '06 #1
2 1662
I am not sure about converting between String^ and std::string. I also don't
use the obfuscators so I don't know how well they work. I am assuming they
work fine.

As for your other questions, I can say that it is not a bad thing that
assemblies don't compile to native. However, if this a requirement for you
then you can compile the assemblies to native images after they are
deployed. The utility for that is called ngen.exe (Native Image Generator).

Also, C++/CLI has deterministic destructors now. You can call delete on a
managed object. That will call its destructor and claim your memory
immediately instead of waiting for the garbage collector.

If it were me, I would make an adapter for String^ and std::string and go
with C++/CLI. Yeah, .NET takes up more memory but there are so many benefits
that I don't consider the extra memory an issue. I remember when people
complained about having to ship MFC's DLL because it required so much memory
too.

<du****@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Hi,

I'm starting a new project and am still torn deciding whether to go
with MFC or to do it in C++/CLI with dotnet. The app makes extensive
use of C++ native libraries which cannot go managed (closed source) and
will have a whole pile of UI. Dotnet is way easier for UI than MFC but
it doesn't compile to native. How much of a speed hit is dotnet UI and
converting back and forth between String^ and std::string*? Do the MSIL
obfucsators work at all? Dotnet seems to be a huge memory hog as well
and GC is kind of slow to reclaim memory. Also, the VC2005 built-in
leak detector seems to be missing (my test project is mixed managed and
unmanaged).

Thanks.

Apr 19 '06 #2
Hi Jeff!
If it were me, I would make an adapter for String^ and std::string and go
with C++/CLI.


A simple and powerful (means that you do not need to take care of
freeing the string explicit) conversion is:
#using <mscorlib.dll>
using namespace System;
#include <tchar.h>
#include <string>

class String2CSTR {
public:
String2CSTR(System::String ^s) throw(...)
:
cp(static_cast<char*>(System::Runtime::InteropServ ices::Marshal::StringToHGlobalAnsi(s).ToPointer()) )

{ }
~String2CSTR() throw()
{

System::Runtime::InteropServices::Marshal::FreeHGl obal(static_cast<System::IntPtr>(cp));

}
operator const char*() const throw()
{
return cp;
}
private:
char* cp;
};

int _tmain()
{
String ^s = "Hallo";
std::string str = String2CSTR(s);
return 0;
}
Greetings
Jochen
Apr 19 '06 #3

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

Similar topics

1
by: GChong | last post by:
Hi, Im looking for some general 'marketing' info on dotnet: how long it has been in use (i.e first release date), how many companies are using it, number of .NET developers in the world,...
12
by: tmb | last post by:
1 - Is Microsoft dotnet a Virtual Machine... like the Java Virtual Machine... that will run on any operating system? 2 - If so, does Microsoft give away the dotnet development system like Sun...
5
by: David | last post by:
Hi everyone, I have a ActiveX EXE component written in VB6. This ActiveX EXE exposes various public methods that can be called by several other independent Windows EXE applications (also written...
0
by: Justin Kennedy | last post by:
Hi, I'm new to dotnet. In fact, I'm a Java/web dev. guy mostly. I was debating on whether to use Java or dotnet for a recent project. The main requirements are: 1. Tools to create a "rich"...
10
by: Darren | last post by:
OK, I'm trying to understand the need for this. If I understand correctly without this anyone can reverse engineer and obtain the source code of my application - is this correct? And this tool will...
0
by: Joe Bloggs | last post by:
Hi all, I take the pleasure to inform that Dotnet Commons Logging has been released for use. Dotnet Commons Logging, a subproject of the Donet Commons project currently located under the...
4
by: Peter Hemmingsen | last post by:
Hi, I have a dotnet object (implemented in mc++ and used in c#) which have a property called "Info". The Info property is also a dotnet object (implemented in mc++). In the constructor of the...
4
by: Peter Plumber | last post by:
OK, this is a rather strange request Is it possible to use dot-net dlls in VB6 projects? Is anyone doing this or is this completely useless? thx Peter
3
by: gg | last post by:
My standard version of dotnet 2003 basic does Not have vbc.exe have class library template produce dll when outputtype is changed to classlib for .vbproj it seems that standard version is not...
7
by: Peted | last post by:
Hi, im hoping someone cane provide or point to a definitive accurate explantion of dotnet compilation when run and the best way to optimise peformace when dotnet code is run first time and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.