473,397 Members | 1,985 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,397 software developers and data experts.

Compiling from native to managed VC++ /clr option dramatically enlarge static lib size.

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.

Jun 12 '06 #1
5 2414
"dovgani" <do*****@hotmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
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.


I guess that you compile all your souce files with /clr. This is seldom
necessary. Consider compiling only those filed with /clr that you really
need to compile to managed code. In the best case, write managed code in a
separate source file and call it from you native code.
Jun 12 '06 #2
>>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.


I guess that you compile all your souce files with /clr. This is seldom
necessary. Consider compiling only those filed with /clr that you really
need to compile to managed code. In the best case, write managed code in a
separate source file and call it from you native code.


But even so, this is a 15 times increase in size. is this normal?

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"
Jun 12 '06 #3
Bruno van Dooren wrote:
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.


I guess that you compile all your souce files with /clr. This is
seldom necessary. Consider compiling only those filed with /clr that
you really need to compile to managed code. In the best case, write
managed code in a separate source file and call it from you native
code.


But even so, this is a 15 times increase in size. is this normal?


It may well be. Consider that the native version has virtually no metadata,
while the managed version has full metadata; including metadata describing
the contents of <windows.h> (or at least parts of it), if it's been
included.

-cd
Jun 13 '06 #4
"Bruno van Dooren" <br**********************@hotmail.com> wrote in message
news:O0****************@TK2MSFTNGP03.phx.gbl...
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.


I guess that you compile all your souce files with /clr. This is seldom
necessary. Consider compiling only those filed with /clr that you really
need to compile to managed code. In the best case, write managed code in
a separate source file and call it from you native code.


But even so, this is a 15 times increase in size. is this normal?

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"


If you compile everything with /clr, this is possible. Roughly spoken,
without /clr, the only metadata is the decoated method names. With /clr, for
eyery function, there is the decorated name (as before), an entry in the
method table, the undecorated name, a custom attribute containing the
decorated name, the method's signature, including C++/CLI specific signature
modifiers ...

As Carl has mentioned, in addition to that there is a P/Invoke function
definition for every native function that is called in the code. For each
P/Invoke function definition, there is a similar overhead as described
above. If the lib contains many functions that wrap another functions 1:1,
the P/Invoke metadata can be a huge amount.

Marcus


Jun 13 '06 #5

Marcus Heege wrote:
"Bruno van Dooren" <br**********************@hotmail.com> wrote in message
news:O0****************@TK2MSFTNGP03.phx.gbl...
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.

I guess that you compile all your souce files with /clr. This is seldom
necessary. Consider compiling only those filed with /clr that you really
need to compile to managed code. In the best case, write managed code in
a separate source file and call it from you native code.


But even so, this is a 15 times increase in size. is this normal?

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"


If you compile everything with /clr, this is possible. Roughly spoken,
without /clr, the only metadata is the decoated method names. With /clr, for
eyery function, there is the decorated name (as before), an entry in the
method table, the undecorated name, a custom attribute containing the
decorated name, the method's signature, including C++/CLI specific signature
modifiers ...

As Carl has mentioned, in addition to that there is a P/Invoke function
definition for every native function that is called in the code. For each
P/Invoke function definition, there is a similar overhead as described
above. If the lib contains many functions that wrap another functions 1:1,
the P/Invoke metadata can be a huge amount.

Marcus


Thank you guys.
A little more details.
I have large(very large) application. Static library I am talking about
is presentation lib
I would like to use a new .NET controls (menu, toolbar).
Another words just to dress a new shell.
After our discussion. I think the best way is to rewrite that lib in
managed code.
But this is not easy job.

Jun 13 '06 #6

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

Similar topics

1
by: Omid Hodjati | last post by:
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...
4
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...
1
by: Bern McCarty | last post by:
What do you make of this? I cannot tell for sure but it almost seems as the the transition thunk to get back from the native bool method to the managed caller is looking at eax and, if any bit is...
3
by: Adam | last post by:
I can't seem to find one spot on the net that specifies exactly what I need to do. Situation: Native dll needs to hold a static reference to a managed class in .net 2.0 (whidbey) which needs to...
7
by: Adam | last post by:
I have a managed cpp wrapper. Im using this in a native dll as a static variable. I need to free this library when the dll is done being used. The perfect place to do this is DllMain for...
2
by: Bart Simpson | last post by:
I am writing a communications library which makes extensive use of the STL and templates in general. I am using VC7 to compile because of alledged better support for templates etc. However, I...
1
by: bvisscher | last post by:
I posted this recently in microsoft.public.vc.language and was redirected here. I also searched this ng and found some relavant threads. The most relavent I found was: ...
8
by: WebSnozz | last post by:
I have an application written in C that does a lot of low level stuff. It does a lot of things like casting from void*'s. I want to create a new GUI for it in either C# or MC++, but reuse the...
6
by: per9000 | last post by:
An interesting/annoying problem. I created a small example to provoke an exception I keep getting. Basically I have a C-struct (Container) with a function-pointer in it. I perform repeated calls...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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,...
0
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...

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.