473,608 Members | 2,054 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compiling unmanaged code as managed

Hi All,
I have an old unmanaged code written in C++ 6.0. This is a
time critcal, CPU bound application. I have deciede
migrate this application to managed world and VC++ 7.0.
The first step was to compile the 6.0 version with /clr to
IL code....That was succesful ... I made clean build !
But the application didn't run. When I profiled the
application execustion i saw that the managed version is 2
times slower that unmanaged version. This stoped me going
forward ...
I have not used and "managed material" in the application
yet. My code is not managed and then there must be no IL
in my PE and then no JITing (except some startup, i
think). I have not refereanced managed heap an then i
expect GC thread to be blocked during the execution....
-I expect the new aplication be, at least; as fast as the
old one. What causes this version to be so slow then ?

I have to ignore using managed environment if i can't find
the reasone.....coz my application is realtime and CPU
bound.

Thanks the help in advanced...
Omid.

Nov 16 '05 #1
1 1831

--------------------
Content-Class: urn:content-classes:message
From: "Omid Hodjati" <om**********@y ahoo.com>
Sender: "Omid Hodjati" <om**********@y ahoo.com>
Subject: Compiling unmanaged code as managed
Date: Tue, 2 Sep 2003 22:20:47 -0700
Lines: 25
Message-ID: <06************ *************** *@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcNx2yHnRYVsMb4 QTQOWkdtbYKkWag ==
Newsgroups: microsoft.publi c.dotnet.langua ges.vc
Path: cpmsftngxa06.ph x.gbl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:27846
NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vc

Hi All,
I have an old unmanaged code written in C++ 6.0. This is a
time critcal, CPU bound application. I have deciede
migrate this application to managed world and VC++ 7.0.
The first step was to compile the 6.0 version with /clr to
IL code....That was succesful ... I made clean build !
But the application didn't run. When I profiled the
application execustion i saw that the managed version is 2
times slower that unmanaged version. This stoped me going
forward ...
I have not used and "managed material" in the application
yet. My code is not managed and then there must be no IL
in my PE and then no JITing (except some startup, i
think). I have not refereanced managed heap an then i
expect GC thread to be blocked during the execution....
-I expect the new aplication be, at least; as fast as the
old one. What causes this version to be so slow then ?

I have to ignore using managed environment if i can't find
the reasone.....coz my application is realtime and CPU
bound.

Thanks the help in advanced...
Omid.


Hi Omid,

When you compile with the /clr option, the VC++ compiler generates CIL
rather than native machine code that can be run immediately. The CIL is
usually translated to native machine code typically at load time by a
JIT-er but you can also pre-JIT this code using ngen.exe which comes with
the .NET SDK.

I'm not sure where the 2x slowdown is coming from, but it could simply be
due to the JIT-er not generating as efficient code as the native
VC++-generated code for some particularly time-critical loop.

A good place to get familiar with the managed world is this:

http://www.microsoft.com/net/


--
Tanveer Gani, Microsoft Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Nov 16 '05 #2

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

Similar topics

4
11337
by: Aaron Queenan | last post by:
When I build a C++ library to .NET using the managed C++ compiler, I get the following error message: Linking... LINK : error LNK2020: unresolved token (0A000005) _CrtDbgReport LINK : error LNK2020: unresolved token (0A000007) memset LINK : error LNK2020: unresolved token (0A000008) free LINK : error LNK2020: unresolved token (0A00000A) atexit LINK : error LNK2020: unresolved token (0A000028) wcscpy LINK : error LNK2020: unresolved...
4
39978
by: Rachel Suddeth | last post by:
What is the difference between a managed/unmanaged resource, and how do you tell which is which? I'm trying to understand how to write some Dispose() methods, and we are supposed to put code that deals with managed in one place, and code that deals with unmanaged in another place, but I can't seem to find anything that clearly explains what that means. I think if I used a Windows API function to optain a handle, that handle would be an...
3
3497
by: zhphust | last post by:
I want to convert a object of a managed class to a unmanaged structure that has the same member with that managed class. Can anybody tell me how i can do it? Thanks in advance. -- zhphust ------------------------------------------------------------------------
1
1639
by: Sparhawk | last post by:
Hi, my company is going to migrate a large VC++ application to .NET to make use of Windows Forms (the old class library is not updated any more). We are not planning to migrate the rest of the code which works well. I understand the basic concept: our code is unmanaged, Windows Forms is Managed and Unmanaged may not call Managed code. I read about Wrappers, PInvoke, Runtime Callable Wrappers for COM and about It just
12
1619
by: doug | last post by:
I understand the basics of what managed code offers and that you open yourself up to security issues if you allow unmanaged code. We already have a decent amount of VB6 code to include COM DLLs. If we put wrappers around some of our code or leave some "asis" what makes our existing production code 'evil' just because it is now considered 'unmanaged'? It may seem like a simple niave question, but the definitions for managed and...
5
2437
by: dovgani | last post by:
I have an unmanaged MFC project. The output is static lib. I would like to compile using /clr option. The native lib size is 64 megs and with /clr and /O1 options is 940 megs. Is it possibly Metadata enlarge size so dramaticlly? And I would like to know any suitable solution of my problem.
6
4111
by: Stephen Walch | last post by:
Our application environment consists of three basic layers: 1. Third-party unmanaged DLLs that were written before the CLR was invented and maintain a significant amount of information (including memory management and connection pooling constructs) as static variables which were intended to scoped to the process. 2. Managed C++ assemblies (.NET 1.1) that wrap the unmanaged DLLs as nice neat classes with managed interfaces.
9
3111
by: Amit Dedhia | last post by:
Hi All I have a VC++ 2005 MFC application with all classes defined as unmanaged classes. I want to write my application data in xml format. Since ADO.NET has buit in functions available for this, I want to use it. Is it possible to call Managed class functions from Unmanaged class? How to do it? I did something like this. I declared a managed class (in C++ CLI) called as MyManagedClass whose
2
12353
by: Jon Slaughter | last post by:
How difficult is it for one to integrate unmanaged C++ into C#? I know for functions one can use DLLimport but how does one go about doing it for classes? Do I have to completely reimplement the classes in managed C++ as a wrapper to the unmanaged C++ classes or is there an easier way? Essentially what I have done is written a C++ kernel mode driver and I want to use it from my C# program. Because it requires some setup outside the...
0
8025
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
8509
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
8493
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8179
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8365
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...
0
6847
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6023
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...
1
1620
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1363
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.