Re: Accelerators & static link



How do I link statically the program?

There are various possible ways, for example,
you can use the following keywords:

-Wl,-Bstatic 
-Wl,-Bdynamic

as in the makefile example below:
---------------------------------

$(EXE): $(APP_o)
#       $(CC) -o $@ $^ $(PATH_l) -Wl,-Bstatic $(LIBS)
        $(CC) -o $@ $^ $(PATH_l) -Wl,-Bdynamic $(LIBS)

%.o : %.c $(APPI_h)
        $(CC) -c $(PATH_h) $< -o $@
--------------------------------
where the first rule links the .o files which
were previously compiled with the second rule.
This way, to change from a dynamic to a static 
executable, you have only to change the commented 
line.

You must take into account that the order
of the libs is important, due to its own
dependencies, the libs line is red from the 
end to the beginning, so you could have for example:

LIBS = -lgtkgl -lgtk -lgdk -lgmodule -lglib -ldl -lGLU \
        -lGL -lXext -lX11 -lXi -lXmu -lvga -lm

These examples are obviously taken from my own code,
you must adapt them to your case.

Carlos




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