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

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

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=fa lse)];
#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;
}
---------------------------------------------------------

Nov 16 '05 #1
1 1213
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

Nov 16 '05 #2

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

Similar topics

6
by: Shai Levi | last post by:
Hi, I'm trying to migrate native c++ class to managed c++ class. The native class header definition looks as: class NativeClass { public: typedef void (CbFunc1)(int n,void* p);
1
by: Jeremy Cowles | last post by:
Is it possible to pass an instance of a standard C++ class into managed memory and use it (MC++/C#/VB/J#)? I guess I am still foggy on the whole concept of Managed C++. TIA, Jeremy
6
by: Itay_k | last post by:
Hello, I want a member in my class that will save pointer to pointer to System::Drawing::Image class. When I write on my class code: System::Drawing::Image **bmp; I get this error message:...
5
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I have a class that is writen in unmanaged pure native C++. This class files (h and cpp) are inserted to a managed C++ (VC++ 2005, C++/CLI) DLL compoenet. This DLL compoenet is used in a C#...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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: 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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
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.