Subject: Re: Export default functions in the API

Re: Export default functions in the API

From: Mikhail Gusarov <>
Date: Wed, 27 Jan 2010 18:44:41 +0600

Twas brillig at 13:39:59 27.01.2010 UTC+01 when did gyre and gimble:

>> SB> Like that libssh2_session_init is not part of LIBSSH2_API and
>> SB> we can't lookup this symbol because it doesn't exist in shared
>> SB> library:

>> Why do you want to lookup it _this_ way?

 SB> Because i don't know another way.

Looking at documentation and headers is better way: libraries may change
implementation, provide versioned symbols, replace regular functions
with macros or inline functions, etc.

Exported symbols in shared object consistute ABI of library, not
API. While it's significant too, but it's another degree of

>> SB> Do you think it's a good idea to change all #define functions ?

>> It does not buy anything meaningful and slightly pessimizes things
>> (number of relocation entries and cost of symbol lookup become
>> higher).

 SB> So, I concluded it's was bad idea. I'm not familliar with symbols
 SB> relocations, could you enlighten me ?

Actually it was nitpicking - symbol relocation costs are neglible on any
modern hardware, except embedded one.

Though as you are interested there is a good doc by Ulrich Drepper
called "How to write shared libraries" describing mechanics of ELF
shared libraries and exported symbols:



Received on 2010-01-27