Mixed source with NASM-entrypoint works in this way (32-bit on my 64-bit-Linux):
printf.asm:
global _start
extern main
extern fflush
section .text
_start:
call main
push 0 ; fflush (stdout)
call fflush
add esp, 4
mov ebx,0 ; exit code, 0=normal
mov eax,1 ; exit command to kernel
int 0x80 ; interrupt 80 hex, call kernel
main.c
#include <stdio.h>
extern int main (void)
{
char* str = "print from C :\\)\n";
printf("%s", str);
return 0;
}
build:
nasm -felf32 -oprintf.o printf.asm
gcc -c -m32 -omain.o main.c
ld -I/lib32/ld-linux.so.2 -lc -m elf_i386 -o printf printf.o main.o
I guess you can manage the changes for 32-bit-Linux :-)