Building a pure managed .EXE in VC++ 2003 IDE

K

Kalafiorczyk

Ladies and Gentlemen of Microsoft!

I'm having a small problem that I hope to be able to
solve without having to burn a support call included
with MSDN.

I have a short "Hello, world!" app that is 100%
portable between Standard C++ and Managed C++.
I can build it with VS7.1 using command line.
But I cannot reproduce my results in the IDE.

Could any kind soul post here or e-mail me a
working .vcproj that has two configurations
(1) normal "debug" and (2) pure managed (not
just managed)?

Again, I'm not asking how to build managed code
that works. I'm asking how to build pure managed
C++ code that passes peverify check. It should
be then both secure and platform independent.

My e-mail address in the headers is easy to fix.

My project is really simple so I include it all here.
It has two .cmd files: to build unmanaged and pure
managed, and single source file.

Thanks for reading,

Sylvester
-------------------------------------------------------
@cl /Od h.cpp /Fohu /Fehu /link /opt:ref
-------------------------------------------------------
@echo off
cl /clr:initialAppDomain /Od h.cpp /Fohm /Fehm nochkclr.obj /link /entry:main /fixed:no /opt:ref
if errorlevel 1 exit
rem permview hm.exe
silo -s hm.exe
peverify hm.exe
-------------------------------------------------------
#ifdef _MANAGED

#using <mscorlib.dll>
using namespace System::Security::permissions;
[assembly:SecurityPermissionAttribute(
SecurityAction::RequestMinimum,SkipVerification=false)];
#define puts System::Console::WriteLine
#define S(x) S##x

#else

#include <cstdio>
#define S(x) x

#endif
int main() {
puts(S("Hello, C++ world!"));
return 0;
}
---------------------------------------------------------
 
K

Kalafiorczyk

Hello Andrew!
Here it is.

Thank you cery much. It works almost exactly as expected;
it creates "/clr" instead of "/clr:initialAppDomain".

I had a look at the generated .vcproj XML files and I'm positive
that there is a way to trigger a bug in VS 2003 IDE by changing
flag setting in certain order. But I don't care about this
anymore, because I've learned how to fix the generated XML in
..vcproj files.

ÁßÐáØÑÞ!

Sylvester
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top