Re: gcc/ld init section and libraries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"John Donoghue" <john.donoghue@xxxxxxxx> writes:

> Im not sure if this question belong in this list but ...
>
> I have a cross compiling suite for m68k-elf I am using for a small
> 68332 board and want to add some code that will be run (initialize
> some stuff for me) when the program runs.

You could try to use the "constructor" attribute:

#include <stdio.h>

void __attribute__((constructor)) f() {
    puts("foo");
}

int main() {
    puts("bar");
    return 0;
}


-- 
	Falk

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux