I want to use my .asm function inside C code. So I compiled my fun.asm file to fun.o and linked that object file in CodeBlocks. (I assume that linking is working because if I delete .o file then CodeBlocks error changes to "no such file...".) This is how my code looks like:
.asm code:
SECTION .DATA
hello: db 'Hello world!',10
helloLen: equ $-hello
SECTION .TEXT
GLOBAL fun
fun:
say_hi:
mov eax,4 ; write()
mov ebx,1 ; STDOUT
mov ecx,hello
mov edx,helloLen
int 80h ; Interrupt
ret ; Return control
.c code:
int main(int argc, char *argv[])
{
extern fun();
fun();
what is the problem with that code? I get an "undefined reference to 'fun'" error