Advertisement

control which symbols are exported in gcc

Started by February 10, 2008 03:52 PM
2 comments, last by truthsayer 16 years, 7 months ago
Hello I am writing a game engine for linux in c. I want to be able to load all games as shared objects instead of statically linking them into the game engine. However, the only way i can figure out to export functions from the engine to the games is by using the -export-dynamic option, which I don't think is a good idea because it exports every symbol, and I only need to export some of them. Can anyone please help me find a way to control which symbols are exported and which aren't on gcc?
Placeholder for better sig.
Perhaps this?
Advertisement
What's wrong with exporting every symbol? C has no namespaces, but it's commonplace to add an prefix_ to all function and type names. If you do that, you should have no problems exporting all symbols.

This seems backwards though. Why compile the engine as the executable and the game as the library? It's usually done the other way around.
Quote: Original post by jonahrowley
What's wrong with exporting every symbol?


1. It slows down startup time.
2. Calling exported functions is slower (even if you're calling within the same library).
3. The compiler can't optimize calls to exported functions.
4. Namespace pollution.
My rating perfectly reflects the pathetic yes-men in-crowd attitude of this forum.

This topic is closed to new replies.

Advertisement