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

Can embed asm code in c#

I want to embeded ASM code in c# code ,like C++ embed asm:
_asc{
mov ax,3
.....
}

how to do?

thanks!

Nov 17 '05 #1
13 2997

"harvie wang" <qu*****@gmail.com> wrote in message
news:5e*************************@news.microsoft.co m...
I want to embeded ASM code in c# code ,like C++ embed asm:
_asc{
mov ax,3
....
}

how to do?


You can't. C# compiles in a relativly machien independent manner, so x86
assembly wouldn't make sense.
Nov 17 '05 #2

"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:uc****************@TK2MSFTNGP14.phx.gbl...

"harvie wang" <qu*****@gmail.com> wrote in message
news:5e*************************@news.microsoft.co m...
I want to embeded ASM code in c# code ,like C++ embed asm:
_asc{
mov ax,3
....
}

how to do?


You can't. C# compiles in a relativly machien independent manner, so x86
assembly wouldn't make sense.


And you can't embed ILASM either, as far as I know, even though that would
make sense (and even be useful on rare occasions.)
Nov 17 '05 #3
> And you can't embed ILASM either, as far as I know, even though that would
make sense (and even be useful on rare occasions.)
thats right and infact writing code in Ilasm inside C# (like __asm in c++)
was submitted as a suggestion to microsoft for C# 2.0 and got a lot of
positive votes but still it was rejected cuz they say it was complicating the
language and nothing valueable enough could be achieved through this feature.

Abubakar,
http://joehacker.blogspot.com

"Mike Schilling" wrote:

"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:uc****************@TK2MSFTNGP14.phx.gbl...

"harvie wang" <qu*****@gmail.com> wrote in message
news:5e*************************@news.microsoft.co m...
I want to embeded ASM code in c# code ,like C++ embed asm:
_asc{
mov ax,3
....
}

how to do?


You can't. C# compiles in a relativly machien independent manner, so x86
assembly wouldn't make sense.


And you can't embed ILASM either, as far as I know, even though that would
make sense (and even be useful on rare occasions.)

Nov 17 '05 #4

"Abubakar" <Ab******@discussions.microsoft.com> wrote in message
news:B3**********************************@microsof t.com...
And you can't embed ILASM either, as far as I know, even though that
would
make sense (and even be useful on rare occasions.)


thats right and infact writing code in Ilasm inside C# (like __asm in c++)
was submitted as a suggestion to microsoft for C# 2.0 and got a lot of
positive votes but still it was rejected cuz they say it was complicating
the
language and nothing valueable enough could be achieved through this
feature.


I tend to agree. Adding an entire sublanguage and primary langauge hookups
for a feature that has very minimal value doesn't make sense. Adding ILASM
could double the complexity of the compiler, IDE, and language to help the
handful of people that would actually use it properly.
Nov 17 '05 #5
I use Reflector to Get ILASM code ,but I can't edit it;
in c# code ,create a new empty function named FunA,such as:

public class test
{
public test(){};
public void FunA(){};
}
then build this code ,I get a test.dll file
Open the test.dll file with Reflector
I get ILASM code
can I edit this code and add ILASM code to the Empty function FunA()?

thanks!

I want to embeded ASM code in c# code ,like C++ embed asm:
_asc{
mov ax,3
....
}

how to do?

thanks!

Nov 17 '05 #6

"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...

"Abubakar" <Ab******@discussions.microsoft.com> wrote in message
news:B3**********************************@microsof t.com...
And you can't embed ILASM either, as far as I know, even though that
would
make sense (and even be useful on rare occasions.)


thats right and infact writing code in Ilasm inside C# (like __asm in
c++)
was submitted as a suggestion to microsoft for C# 2.0 and got a lot of
positive votes but still it was rejected cuz they say it was complicating
the
language and nothing valueable enough could be achieved through this
feature.


I tend to agree. Adding an entire sublanguage and primary langauge hookups
for a feature that has very minimal value doesn't make sense. Adding ILASM
could double the complexity of the compiler, IDE, and language to help the
handful of people that would actually use it properly.


Actually, I agree too. Allowing ILASM and C# files to be linked into the
same assembly would solve the same set of problems much more naturally. (It
still strikes me as bizarre that a system deisgned from day one to support
multiple languages and compiles them all to a common object format doesn't
support heterogeneous linking.)
Nov 17 '05 #7
You can code in IL assembler and call the dll method from c#

http://www.geocities.com/jeff_louie/...ing_il_dll.htm

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #8
>>
I tend to agree. Adding an entire sublanguage and primary langauge
hookups for a feature that has very minimal value doesn't make sense.
Adding ILASM could double the complexity of the compiler, IDE, and
language to help the handful of people that would actually use it
properly.


Actually, I agree too. Allowing ILASM and C# files to be linked into the
same assembly would solve the same set of problems much more naturally.
(It still strikes me as bizarre that a system deisgned from day one to
support multiple languages and compiles them all to a common object format
doesn't support heterogeneous linking.)


Ya, that was always odd, although the system itself supports it, the two big
languages(VB and C#) do not. C++ might, I'm not sure off hand. It is
certainly possible at the lowest levels.

It'd be nice if they would just provide an IDE that supports it, not to
mention a good IDE for editing IL code in VS. I'd love to have a good
Reflecter clone in VS, although I know that it would potentially give MS
problems for providing decompilers.
Nov 17 '05 #9

"Jeff Louie" <je********@yahoo.com> wrote in message
news:uD*************@tk2msftngp13.phx.gbl...
You can code in IL assembler and call the dll method from c#


I do that now; it just seems stupid to have an entire assembly to hold the
three methods I can't write in C#.
Nov 17 '05 #10
u can also do this: use ildasm to save a file in il file and than change
with notepad and compile with ilasm.

Ab.

"harvie wang" <qu*****@gmail.com> wrote in message
news:5e*************************@news.microsoft.co m...
I use Reflector to Get ILASM code ,but I can't edit it;
in c# code ,create a new empty function named FunA,such as:

public class test
{
public test(){};
public void FunA(){};
}
then build this code ,I get a test.dll file
Open the test.dll file with Reflector
I get ILASM code
can I edit this code and add ILASM code to the Empty function FunA()?

thanks!

I want to embeded ASM code in c# code ,like C++ embed asm:
_asc{
mov ax,3
....
}

how to do?

thanks!


Nov 17 '05 #11
Hello Jeff,

I can't access this link:(
Could you show this contents Here,Thanks!

You can code in IL assembler and call the dll method from c#

http://www.geocities.com/jeff_louie/...ing_il_dll.htm

Regards,
Jeff
*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #12
OK..
Here is the assembler code that prints a string to the console wrapped
in a dll
call testildll. To compile this code is the ilasm with the /dll
directive:
ilasm testildll.il /dll


You can then add a reference to the dll in your C# project and call the
method.

// testildll.il
// 11.29.04 Jeff Louie
.assembly extern mscorlib {}
.module testildll.dll
.class public auto autochar Class2
{
.method public hidebysig static void Test() cil managed
{
.maxstack 1
ldstr "JAL 11.25.04"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
}

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #13
Hello Jeff,

hoho:)
I see
Thanks!

OK..
Here is the assembler code that prints a string to the console wrapped
in a dll
call testildll. To compile this code is the ilasm with the /dll
directive:
ilasm testildll.il /dll

You can then add a reference to the dll in your C# project and call
the method.

// testildll.il
// 11.29.04 Jeff Louie
.assembly extern mscorlib {}
.module testildll.dll
.class public auto autochar Class2
{
.method public hidebysig static void Test() cil managed
{
.maxstack 1
ldstr "JAL 11.25.04"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
}

Regards,
Jeff
*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #14

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

Similar topics

0
by: Wolfgang Schwanke | last post by:
Dear usenet, I'm having the following small problem. I've been ask to add some Quicktime panoramas to a website. The author of the panoramas has made two versions of each: One in MOV format,...
3
by: Tony Sutton | last post by:
I have this following code in my html file: <object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#...
11
by: Anna | last post by:
Hi all. I want to embed the EMBED tag in the object tag. I understood that I need to provide a PARAM tag inside the OBJECT whose value will hold the content of EMBED src attribute, but after...
2
by: Cris Curtis | last post by:
When I use an embed tag that uses a dynamic aspx page, the dynamic aspx page appears to get called 2 times instead. Below is code that adds an embed tag to a placeholder control that will use...
1
by: Andrew Poulos | last post by:
With "normal" SWF HTML there's an EMBED tag nested within an OBJECT tag. How can I check which tag is actually displaying the SWF? I'm using CSS on them and the style on the OBJECT affects the...
2
polymorphic
by: polymorphic | last post by:
I am no longer good at Javascript and need help. I'm trying to embed pdf files in html then build some sort of navigation between the pdfs via the pdf numbered file name. I can generate the...
2
dream party
by: dream party | last post by:
Inserting a Flash (SWF, FLV) file into HTML web page is already an old and familiar thing to all of us. It is a rather non-flexible thing that just to edit some options in the template. However, I...
1
by: MoroccoIT | last post by:
Greetings - I have a CF Form that uploads news articles, at times, I like to paste Youtube Videos with my articles. I noticed that on one server, it works fine, but on a different hosting company,...
1
by: movieking81 | last post by:
This really isn't an ASP question, but the code is ASP so feel free to move this to the right place if necessary. I have two ASP pages with some embed code on them on two different hosting...
1
by: movieking81 | last post by:
I have some html pages with some embed code on them on two different hosting platforms. First one (Win2003,IIS) <object> <param name='movie' value='st1.mov'> <embed src='st1.mov' width='725'...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.