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

Calling IL instruction from C# code

Hi !

I am looking for a way to call IL instruction from withing C# code. I
am not talking about System.Reflection.Emit sort of topics, but rather
about existing C# code, where I want to call IL instruction.

More specificly, I want to call "OpCodes.Nop" instruction in C# code
in order to make some label for myself, which I would be able to
identify while reflecting IL generated code.

So far, I found InvokeMethod methods in different classes (like
Type.InvokeMethod), but they don't seem to meet my needs.

Any ideas ?

Thanks
Jean
Nov 15 '05 #1
2 2224
Jean,

I don't understand why you want to call Nop as a label? If you reflect
on some code, it doesn't show you what op codes were executed, rather, what
is stored in the assembly. If you call Nop yourself, that won't be shown
anywhere using reflection.

What exactly are you trying to do?

If you want to make your own IL calls, then I think you would have to
create your own assembly in memory and then execute the methods on the types
in that assembly.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Jean Stax" <je*******@hotmail.com> wrote in message
news:df**************************@posting.google.c om...
Hi !

I am looking for a way to call IL instruction from withing C# code. I
am not talking about System.Reflection.Emit sort of topics, but rather
about existing C# code, where I want to call IL instruction.

More specificly, I want to call "OpCodes.Nop" instruction in C# code
in order to make some label for myself, which I would be able to
identify while reflecting IL generated code.

So far, I found InvokeMethod methods in different classes (like
Type.InvokeMethod), but they don't seem to meet my needs.

Any ideas ?

Thanks
Jean

Nov 15 '05 #2
Hi !

I wanted to create somthing that analyzes / parses IL code (IL
instructions, which are resulted from C# compillation). Now I thought
about the way to find the correspondence between the line in C# code
and IL code. Of course, one C# line maybe transkated to a couple of IL
lines (instructions). By "labeling" the C# code, I thought I would be
able to reach this correpondence.

Maybe you have some better ideas ?

Thanks.
Jean.

"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message news:<ub**************@TK2MSFTNGP11.phx.gbl>...
Jean,

I don't understand why you want to call Nop as a label? If you reflect
on some code, it doesn't show you what op codes were executed, rather, what
is stored in the assembly. If you call Nop yourself, that won't be shown
anywhere using reflection.

What exactly are you trying to do?

If you want to make your own IL calls, then I think you would have to
create your own assembly in memory and then execute the methods on the types
in that assembly.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Jean Stax" <je*******@hotmail.com> wrote in message
news:df**************************@posting.google.c om...
Hi !

I am looking for a way to call IL instruction from withing C# code. I
am not talking about System.Reflection.Emit sort of topics, but rather
about existing C# code, where I want to call IL instruction.

More specificly, I want to call "OpCodes.Nop" instruction in C# code
in order to make some label for myself, which I would be able to
identify while reflecting IL generated code.

So far, I found InvokeMethod methods in different classes (like
Type.InvokeMethod), but they don't seem to meet my needs.

Any ideas ?

Thanks
Jean

Nov 15 '05 #3

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

Similar topics

3
by: rahul8143 | last post by:
hello, I write a following program and have problem in understanding constructors and destructors. #include <iostream.h> class vector { public: double x; double y;
19
by: Ross A. Finlayson | last post by:
Hi, I hope you can help me understand the varargs facility. Say I am programming in ISO C including stdarg.h and I declare a function as so: void log_printf(const char* logfilename, const...
16
by: Saroj | last post by:
Is there an way for a function to know who called him ?
2
by: Geler | last post by:
A theoretical question: Sorry if its a beginner question. Here is a quote from the MSDN explaning the C/C++ calling convention.. It demonstrates that the calling function is responsible to clean...
7
by: Lee Crabtree | last post by:
I remember when I was first getting into .NET Forms programming that there was a rather emphatic rule about not constructing a form before calling Application.Run with it. So this: ...
1
by: | last post by:
I'm trying to think something through and am wondering if may have some suggestions. I am building a Windows service (VStudio 2005, C#) that uses a COM component to answer a telephone call(s). ...
2
by: gwell | last post by:
Hi, I have a C# assembly that is calling directly into C++ unmanaged code. Everything is working fine but at the very end of the process I get an application error, which says: "The...
6
by: gwell | last post by:
Hi, I have a C# assembly that is calling directly into C++ unmanaged code. Everything is working fine but at the very end of the process I get an application error, which says: "The...
2
by: unauthorized | last post by:
The short story: I need to be able to cast a function pointer for any function and class to an intermediate type, so I could call it from any point of my program using the "__asm call" instruction....
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.