Hi,

<problem1>
I failed to rebuild (without any modifications) the
source downloaded from the article you mentioned,
"Rewriting MSIL Code on the Fly with the .NET
Framework Profiling API".

I tried using Microsoft Development Environment 2003
Version 7.1.3088 (Microsoft .NET Framework 1.1 Version
1.1.4322).

This is the error message I received:
Compiling...
ConstraintsChecker.cpp
c:\NETProfilingAPI\CChecker\ConstraintsChecker.cpp(17)
: fatal error C1853: 'Debug/CChecker.pch' precompiled
header file is from a previous version of the
compiler, or the precompiled header is C++ and you are
using it from C (or vice versa)

The author's responsed to my question:
At the time of writing of the article (~
August-September, 2002) I was using VC.NET 2002 (v7.0)
with .NET v1.0 headers to compile my code. I've never
used my code with VC++ .NET 2003. And, since I still
don't have VC.NET 2003 on my machine I cannot tell
you too much about the error you're getting. Make sure
VC.NET 2003 uses .NET 1.0 headers and check for VC.NET
2002/2003 compatibility issues.

<problem2>
Also, I never successfully build a simple C++ "Hello
World" program:
#include <iostream.h>
int main() {
  cout << "Hello World!" << endl;
  return 0;
}
[ERROR on the first line] fatal error C1010:
unexpected end of file while looking for precompiled
header directive

I have installed a complete set of Visual C++ Static
CRT Libraries as discussed in PSS ID Number: Q316343
in MSDN Knowledge Base.

Are there any workarounds for these problems?

Thank you very much beforehand.


sincerely,
Memomana Ryge


--- Jan Kotas <[EMAIL PROTECTED]> wrote:
> Check "Rewrite MSIL Code on the Fly with the .NET
> Framework Profiling
> API" article on MSDN:
>
http://msdn.microsoft.com/msdnmag/issues/03/09/NETProfilingAPI/default.a
> spx . It should have answers to all your questions.
>
> Note that there is bug in the profiler
> implementation in the final Rotor
> v1 release - more details are at
>
http://www.mail-archive.com/[EMAIL PROTECTED]/msg00511.ht
> ml.
>
> You may also want to a look at
> ICorProfilerInfo::SetEnterLeaveFunctionHooks. It
> gives you simple
> Enter/Leave callbacks without rewriting the IL.
>
> -Jan
>
> This posting is provided "AS IS" with no warranties,
> and confers no
> rights.
>
> -----Original Message-----
> From: Discussion of the Rotor Shared Source CLI
> implementation
> [mailto:[EMAIL PROTECTED] On Behalf
> Of SUBSCRIBE
> DOTNET-ROTOR Memomana
> Sent: Wednesday, November 26, 2003 8:11 PM
> To: [EMAIL PROTECTED]
> Subject: [DOTNET-ROTOR] Method's IL Modification
>
> I have followed the guide to use
> Get/SetILFunctionBody posted a while
> ago by
> Jan Kotas. The code works fine in my Rotor build.
>
> I would like to modify the code so that the Main
> method displays a
> "Please
> Help" message before returning. i.e. if the original
> Main method
> displays
> "Hello World", then the new code will make it
> display "Hello World" AND
> "Please Help".
>
> In other words, the difference with Jan's code is
> that instead of
> replacing
> the original Main method's IL by a new IL to display
> "Hello World", my
> intention is to keep the original Main method's IL
> and add other new ILs
> (in
> this case, IL to display "Please Help" message).
>
> I have managed to augment the IL code for displaying
> "Please Help"
> before
> Main returns.
>
> Original IL code:
> 13 30 01 00 0b 00 00 00 00 00 00 00 72 01 00 00 70
> 28 02 00 00 0a 2a
>
> My modified IL code:
> 13 30 01 00 0b 00 00 00 00 00 00 00 72 01 00 00 70
> 28 02 00 00 0a [72 1c
> 00
> 00 70 28 02 00 00 0a] 2a
>
> The brackets are included only for easy reading.
>
> Basically, I copied the original bytecode into a new
> (BYTE *) variable,
> say
> BYTE *X. Then, the last original bytecode (i.e. 2a)
> is copied to be the
> last
> bytecode of X. In between, I inserted the [72 1c 00
> 00 70 28 02 00 00
> 0a].
>
> However, the Rotor complained:
> "VALIDATION FAILS: inPtr + sizeof(unsigned int) <=
> inBuffEnd
> At World.HelloWorld::Main at a
> Unhandled Exception: System.InvalidProgramException:
> Common Language
> Runtime
> detected an invalid program.
>    at World.HelloWorld.Main()"
>
> I figured that the new IL is not valid since,
> obviously, the size of the
> IL
> code is larger.
> #1 How would we determine how much bigger?
> #2 How would we set the new size back using the
> SetILFunctionBody
> function?
> #3 Any other (better) way to instrument the method's
> IL code?
>
> Thank you beforehand.
>
> ===================================
> This list is hosted by DevelopMentor(r)
> http://www.develop.com
> NEW! ASP.NET courses you may be interested in:
>
> 2 Days of ASP.NET, 29 Sept 2003, in Redmond
> http://www.develop.com/courses/2daspdotnet
>
> Guerrilla ASP.NET, 13 Oct 2003, in Boston
> http://www.develop.com/courses/gaspdotnet
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>
> ===================================
> This list is hosted by DevelopMentor?
> http://www.develop.com
> NEW! ASP.NET courses you may be interested in:
>
> 2 Days of ASP.NET, 29 Sept 2003, in Redmond
> http://www.develop.com/courses/2daspdotnet
>
> Guerrilla ASP.NET, 13 Oct 2003, in Boston
> http://www.develop.com/courses/gaspdotnet
>
> View archives and manage your subscription(s) at
http://discuss.develop.com


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to