473,473 Members | 1,825 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Using Assembly Procedures with C

I'm still very much a beginner when it comes to programming assembly for
the x86. I've read through one book, so I understand the very basics,
but that's about as far as my knowledge in Assembly goes. Now, I've been
writing a bit of assembly code that I'd like to be able to call as a C
function. My book doesn't describe how to do this. Could someone please
point me to a resource which would allow me to learn this skill? I'm
using NASM, if that helps any. Thanks in advance for any advice.

-Regards
Amol Vaidya

Nov 14 '05 #1
4 1630
On Sun, 26 Dec 2004 06:13:55 GMT, Amol Vaidya <my*****@gmail.com>
wrote in comp.lang.c:
I'm still very much a beginner when it comes to programming assembly for
the x86. I've read through one book, so I understand the very basics,
but that's about as far as my knowledge in Assembly goes. Now, I've been
writing a bit of assembly code that I'd like to be able to call as a C
function. My book doesn't describe how to do this. Could someone please
point me to a resource which would allow me to learn this skill? I'm
using NASM, if that helps any. Thanks in advance for any advice.


Sorry, but you're asking in the wrong place. The C language does not
define linkage to _any_ other language, so what you want to do is
off-topic here.

Most C implementations provide some method of doing this, but the
details are quite different between compilers and operating systems.

There are two places you should ask for better information.

1. The moderated newsgroup news:comp.lang.asm.x86

2. A group that supports your particular compiler and operating
system combination.

In both cases, you need to provide more information about your
compiler and OS.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #2
Jack Klein wrote:
On Sun, 26 Dec 2004 06:13:55 GMT, Amol Vaidya <my*****@gmail.com>
wrote in comp.lang.c:

I'm still very much a beginner when it comes to programming assembly for
the x86. I've read through one book, so I understand the very basics,
but that's about as far as my knowledge in Assembly goes. Now, I've been
writing a bit of assembly code that I'd like to be able to call as a C
function. My book doesn't describe how to do this. Could someone please
point me to a resource which would allow me to learn this skill? I'm
using NASM, if that helps any. Thanks in advance for any advice.

Sorry, but you're asking in the wrong place. The C language does not
define linkage to _any_ other language, so what you want to do is
off-topic here.

Most C implementations provide some method of doing this, but the
details are quite different between compilers and operating systems.

There are two places you should ask for better information.

1. The moderated newsgroup news:comp.lang.asm.x86

2. A group that supports your particular compiler and operating
system combination.

In both cases, you need to provide more information about your
compiler and OS.


Ahh. My appologies for posting this in the wrong place. Thanks for the
information.

Nov 14 '05 #3
basically it's *very* hard to do it any other way than using an __asm block,
so just put __asm {..<your assembly here > ..} in your function.
Doing it any other way is possible and some would argue better but to be
honest I've tried it and it's far more trouble than it's worth, an immense
PITA for what you would think would be an easy process. Oh no. Basically I
tried to find the Microsoft assembler only to find it wasn't included in the
SDK, I was then led on a wild goose chase round a load of warez sites trying
to find what the compiler can do internally of its own accord and without
any (otherwise unnecessary) boilerplate definitions at the top of the asm
file anyway.

"Amol Vaidya" <my*****@gmail.com> wrote in message
news:DE*****************@fe2.texas.rr.com...
I'm still very much a beginner when it comes to programming assembly for
the x86. I've read through one book, so I understand the very basics, but
that's about as far as my knowledge in Assembly goes. Now, I've been
writing a bit of assembly code that I'd like to be able to call as a C
function. My book doesn't describe how to do this. Could someone please
point me to a resource which would allow me to learn this skill? I'm using
NASM, if that helps any. Thanks in advance for any advice.

-Regards
Amol Vaidya

Nov 14 '05 #4
Amol Vaidya wrote:
I'm still very much a beginner when it comes to programming assembly for
the x86. I've read through one book, so I understand the very basics,
but that's about as far as my knowledge in Assembly goes. Now, I've been
writing a bit of assembly code that I'd like to be able to call as a C
function. My book doesn't describe how to do this. Could someone please
point me to a resource which would allow me to learn this skill? I'm
using NASM, if that helps any. Thanks in advance for any advice.

-Regards
Amol Vaidya


Although, off-topic, a better option would be to write your assembly
code for a particular assembler and assemble it to make object files.
NASM is a good option. Link your object files with your C code to form
the final executable.

Regards,
Jonathan
Nov 14 '05 #5

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

Similar topics

2
by: Yves Touze | last post by:
Hi All, I'm trying to migrate from SQL Server 7.0 to SQL Server 2000. I've got some ASP page which call VB components that retrieve shaped recordsets from SQL Server using the MSDATASHAPE...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
1
by: Marc Stober | last post by:
Hi, I am thinking that it would be a good idea to use .NET resources to store SQL statements that would otherwise be hard-coded into an application. I could even store them in a text file as...
12
by: Charlie | last post by:
Hi: My host will not allow me use a trusted connection or make registry setting, so I'm stuck trying find a way to hide connection string which will be stored in web.config file. If I encrypt...
2
by: Tim Wallace | last post by:
I'm a .Net noob. I created a dll using c#. Now, I want to reference that DLL in an ASPX page. I put the import directive in the page like this: <%@ Import Namespace="BHQ.BusinessLogicLayer" %>...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
85
by: fermineutron | last post by:
Some compilers support __asm{ } statement which allows integration of C and raw assembly code. A while back I asked a question about such syntax and was told that __asm is not a part of a C...
2
by: Jeff | last post by:
Hi I'm trying to achieve a scenario where I have c# files that are compiled dynamically, the assemblies are then loaded in a different AppDomain, I call a simple method from the object, and then...
3
by: Tod Birdsall | last post by:
Hi, My boss has asked me to create a tool that can give us a list of stored procedure names that are being called from each of our app's web pages. This is an ASP.NET application that is rather...
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
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.