we have already known that there should be some initialization to
work with the stl. To use that library. There are objects that there
should be initialized before entering main.
I think that I receive this run time SIGSEG due to that.
So any idea ?
I have use a simple C++ program and compiled it only and make the
printf.o.using this command
#include <iostream>
extern "C"
{
void print ( int a )
{
std::cout << a << std::endl;
}
}
g++ -c printf.o
and this is the nasm print.asm
extern _printf
SECTION .data
a dd 5 ; int a = 5;
SECTION .text ; code section
global main
global _WinMain@16
main:
push ebp
mov ebp ,esp
mov eax , [a]
push eax
call _printf
pop ebp
ret
_WinMain@16:
mov eax , 0
call main
ret 16
nasm -f elf print.asm
g++ -g -o print.exe print.o printf.o
and when I run this , it gives an SIGSEGV inside the function ,
(gdb) step
Single stepping until exit from funct
which has no line number information.
0x7c90eaf0 in _libmsvcrt_a_iname ()
_libmsvcrt_a_iname () << method $ucks !, C stdlib printf works fine ,but for this probablly this is due
to non initialized standard library global static objects.
how can I do this when I write the _WinMain@16 method method
inside the asm file ? How can I say or call a method to initialize
the stl ?
what to do in this situation.
I need you're expertise.
--thanks in advance--