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

Home Posts Topics Members FAQ

mixing c and assembly. On the terminal nothing printed

1 New Member
I wrote here is a simple code:

Expand|Select|Wrap|Line Numbers
  1. printf.asm
  2.  
  3.  [EXTERN main]
  4.  section .text
  5.  global _start     
  6.  _start:
  7.        call main
  8.        add esp, 8
  9.        mov eax, 1
  10.        xor ebx, ebx
  11.        int 80h
and main.c

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2.  
  3.  int main()
  4.  {
  5.      char* str = "print from C :\\)";
  6.      printf("%s", str);
  7.  }
I compile code like this:

Expand|Select|Wrap|Line Numbers
  1. nasm -g -f elf printf.asm -o printf.o
  2.  
  3. gcc -c -o main.o main.c
  4.  
  5. ld -o printf printf.o main.o -lc -I/lib/ld-linux.so.2
And run:

Expand|Select|Wrap|Line Numbers
  1. ./printf
On the terminal nothing printed. Why ?

How to solve this problem ?
May 4 '14 #1
1 1315
donbock
2,426 Recognized Expert Top Contributor
What does "int 80h" do ( line 11 of printf.asm)?
If printf output is spooled, then your program could hit that "int 80h" before any characters are output. If that int stops the program then you might not see any output.
May 4 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: nfr | last post by:
I understand an assembly is nothing more than a collection of types in a versioned binary (EXE or DLL) in one or more physical files. Is there any kind of relationship between the assembly name and...
4
by: Rudolf | last post by:
Is it possible to add a vb.net source code module to a c# project and if so how? Thanks Rudolf
2
by: Brandon Bloom | last post by:
I am developing a small game in my spare time using .NET. I am curious about using assembly resources as the storage location for my game assets. It seems natural to embed models, textures, sounds,...
16
by: Justin Lazanowski | last post by:
Cross posting this question on the recommendation of an I have a .NET application that I am developing in C# I am loading information in from a dataset, and then pushing the dataset to a grid,...
1
by: Philip Carnstam | last post by:
Hi, I am building an application where I want users to be able to build their own assemblies that they can implement and share in the application. The problem is that I want to add security to...
3
by: DDE | last post by:
Hi everybody, I developed an assembly common to all my Web Services, so I registered it and put it in the Global Assembly Cache. Now, I modified this assembly, but cannot succed to have this new...
0
by: Brian Young | last post by:
My department is responsible for creating custom internal applications for many of our departments. Our strategy has always been to develop our applications as ActiveX controls (VB6) that get...
0
by: hce | last post by:
Hi, I am running Python and a script on XP DOS terminal, the script build.py printed out messages on the Terminal, then asked for an input of numbers. But, I pressed a key, nothing came in DOS...
0
by: Gabriel Genellina | last post by:
En Fri, 09 May 2008 01:42:21 -0300, hce <webmail.hce@gmail.comescribió: Next time try with Ctrl-Break. It's hard to say what's wrong without seeing the script. -- Gabriel Genellina
1
by: codefragment | last post by:
Hi (Second CAS question) At the assembly level I have: at the method level I have
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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 ...

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.