[LLVMdev] Question about appending linkage

Talin viridia at gmail.com
Tue Apr 1 21:36:47 PDT 2008


I'm trying to figure out how to do static initialization (like static 
constructors in C++ or Java). I figured I would use appending linkage - 
that is, for each module I'd generate a function that did all of the 
static initialization for that module, and then I'd put a pointer to 
that function in an array with appending linkage. Then my 
compiler-generated startup code would simply iterate through the array 
and call each function in turn, before calling my "main" method.

Only problem is - how do I know when I've reached the end of the array?

-- Talin




More information about the llvm-dev mailing list