Hi,
I found another post where there was a note to avoid _ before the procedure name with elf. I cannot find the reason this do not work.
Sorry if the question is trivial.
More I would know if I should expect some change using the g++ and generally speaking a native c++ instead than c during this operations.
Thanks
This is the c++
#include<cstdio>
int main(void) {
int x = 25, y = 70;
int value ;
extern int test1(int,int,int);
value = test1(x, y, 5);
printf("Result = %d\n", value);
return 0;
}
This is the nasm
section .text ; Section containing code
global test1
test1:
enter 0,0
mov eax,[ebp+8] ; get argument 1 (x)
add eax,[ebp+12] ; add argument 2 (y)
sub eax,[ebp+16] ; substract argument 3 (5)
leave
ret
This is the make result:
nasm -f elf -g -F dwarf hll1-asm.asm -l hll1-asm.lst
gcc -o hll1 hll1-cpp.o hll1-asm.o
hll1-cpp.o: In function `main':
hll1-cpp.cpp:(.text+0x31): undefined reference to `test1(int, int, int)'
collect2: ld returned 1 exit status
make: *** [hll1] Error 1
Thanks
Fabio D'Alfonso