load_module call in vcl

Łukasz Barszcz / Gadu-Gadu l.barszcz at gadu-gadu.pl
Thu Jan 13 08:21:51 CET 2011


On 12.01.2011 22:58, Izak Burger wrote:
> Hi all,
>
> I've been studying the embedded C code used by the geoip plugin and 
> noticed how dlopen is used to load this functionality by declaring a 
> load_module procedure. What I cannot seem to figure out is where and 
> how this is called (grep is not my friend tonight), so at present it 
> seems almost like magic (or more likely, a level of indirection I'm 
> missing). Can anyone enlighten me?
__attribute__((constructor)) void
load_module()

First line causes this function to be executed at library load (or 
before main when used in programs).
>
> Also, is there an unload_module or similar partner procedure that one 
> can define for cleanup purposes?
>
There also is destructor which is called on library unload (after main). 
Some more info on gcc attributes: 
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html


-- 
Łukasz Barszcz
web architect
Pion Aplikacji Internetowych
GG Network S.A   http://www.gadu-gadu.pl
ul. Kamionkowska 45   03-812 Warszawa
tel.: +48 22 4277900   fax.: +48 22 5146498   gg:16210

Spółka zarejestrowana w Sądzie Rejonowym dla m. st. Warszawy, XIII
Wydział Gospodarczy KRS pod numerem 0000264575, NIP 867-19-48-977.
Kapitał zakładowy:  1 758 461,10 zł - wpłacony w całości.





More information about the varnish-dev mailing list