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




Marcus Heege wrote:
"Bruno van Dooren" <bruno_nos_pam_van_dooren@xxxxxxxxxxx> wrote in message
news:O0%236qLmjGHA.1276@xxxxxxxxxxxxxxxxxxxxxxx
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
bruno_nos_pam_van_dooren@xxxxxxxxxxx
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.

.



Relevant Pages

  • Re: Getting started on the HP49g+
    ... either the original HP extable lib ... extable2 lib from http://www.hpcalc.org/details.php?id=3940. ... ask again if you have any problem installing libraries. ... compile the string with ASM (listed in the development lib menu, ...
    (comp.sys.hp48)
  • Re: Help on coredll.dll
    ... I have compiled the code using eVC 3.0 and have no problem, ... So I guess I need an extra lib for SIP support in cVC 4.0. ... I use standard SDK and try to compile for ARM device. ...
    (microsoft.public.windowsce.app.development)
  • Compiling test classes that use mock objects from other Netbeans project
    ... Netbeans project. ... main and lib. ... project) so in the main project I had to add a reference to the lib ... fine and allows B.java to compile perfectly. ...
    (comp.lang.java.help)
  • Re: Where can I find a C complier
    ... > usually contain information that is usefull to compile the program. ... If a important lib wasnt found, ... Download the httpd package from apache.org ... Install the kernel-source package for the kernel you are running. ...
    (Fedora)
  • Re: extended stored proc programming
    ... far as I can see the only reason to use managed code is to access the wide ... You're talking as if it's better to have MSIL than native machine code, ... in my .cpp file that is compiled with /clr to compile to native, ...
    (microsoft.public.dotnet.languages.vc)