<-
Apache > HTTP Server > Documentation > Version 2.4

Ϟü (DSO)

݋b _ _ Ɯ”. ٿ ~@ ݋ O[.

Hġ ݋Lb ڰ @ ø[ ݋L ` @ r ] b ȭ α׷ƴ. ݋L HV httpd HϿ rڷ @ H ] . ”R @ httpd Hϰ и[ Ϟü(Dynamic Shared Objects, DSO) H ] . DSO @ ݋L HV Hϸ[ų, Apache Extension Tool (apxs)@ ȝ~[ ߿ Hϸ[ ߰ ] .

݋b DSO ȝ~^ Ʒ@ Ѵ.

Support Apache!

O

top

Hġ U rڷ Hؾ mod_so.cb @ Hġ @ нƱ DSO Ѵ. @ core ܸ[O DSO ] ^b Ϟ ƴ. ٸ Hġ @ ġ ݋݋ configure --enable-module=shared ӛ@ ȝ~[ DSO H ] . @ mod_foo.so DSO H apache2.conf HϿ mod_so LoadModule w ȝ~[ ݋L C۳C Ȥ@ C۳C @ н ] .

Hġ (Ư ڰ ) ȝ~ DSO H@ apxs (APache eXtenSion)b ؛ο α׷ . α׷@ Hġ z h DSO ȝ~ @ HV ȝ~Ѵ. @ . Hġ ġV configure make install Hġ C cH@ ġ[O, DSO H@ Hϸ[ E ƯϞ Hϵ\ ӛ Ŀ ӛ@ apxs α׷ UѴ. E݋ apxs ȝ~[b ȝ~ھb Hġ z h^, DSO @ E ƯϞ Hϵ\ ӛ Ŀ ӛ _@ oʽO _ Hġ z H ] .

top

ȝ~^

Apache 2.2 DSO ɿ ªO ƴ:

  1. b Hġ @ Hϸ[O ġ[b . 齁 mod_foo.c DSO mod_foo.so:

    $ ./configure --prefix=/path/to/install --enable-foo=shared
    $ make install

  2. ڰ Hġ @ Hϸ[O ġ[b . 齁 mod_foo.c DSO mod_foo.so:

    $ ./configure --add-module=module_type:/path/to/3rdparty/mod_foo.c --enable-foo=shared
    $ make install

  3. Ϟ @ ߿ ȝ~[ Hġ 伺[b :

    $ ./configure --enable-so
    $ make install

  4. ڰ Hġ @ Hϸ[O ġ[b . apxs ȝ~[ Hġ z h mod_foo.c DSO mod_foo.so:

    $ cd /path/to/3rdparty
    $ apxs -c mod_foo.c
    $ apxs -i -a -n foo mod_foo.la

ϸZ Ϟ HϵǔR, apache2.conf LoadModule C ȝ~[ Hġ @ нư 늴.

top

e

Ϟ[zb Ϟü (DSO) W/ε(dynamic linking/loading)ƶO [, Ư e ȵ @ 齁 α׷ ּҰ нƾb ɓ .

ΰ Ҏ^ڷ н ] . [b α׷ CV ld.sob Cz α׷ ڵڷ нƾb O, ٸ [b α׷ dlopen()/dlsym() Czx Ϟ[z δ(loader) Cz z@ ȝ~[ нƾb .

ù偓 DSO Ϟƺ\(shared libraries) Ȥ@ DSO ƺ\O θ, Hϻ@ libfoo.so libfoo.so.1.2 @ Ɠ@ . Ƶ@ Cz 丮( /usr/lib) O, HϳC Ŀ w -lfoo ֽ Hϰ Ѵ. Ʒ Y ƺ\b HϿ ǿ݋, α׷ CV Ŀ ӛ -R r , ȯ溯] LD_LIBRARY_PATH r Ȥ@ /usr/lib݋ Ϟ[z δ libfoo.so ã@ ] . ׵\R α׷ ( oã@(unresolved)) U(symbol)@ DSO݋ ãԵȴ.

DSOb α׷ U@ ãʱ V얿 (DSO ȝ~ ^ ȵ ƺ\ƹǷ) ãb ݋ . Ϟ[z δ U ã⸦ [Ƿ α׷ DSO݋ U@ ã@ ʿ䰡 ^. (ȝ ld.so θb ȵb r Ƈ α׷ rǾb C Cۃȵ Ϻδ.) ƺ\ ȵ带 ڷ нƾb @ Ȯ[. ƺ\ ȵ尡 α׷ ߺ݋ vǾb _ libc.so @ Cz ƺ\ 偸 vDZ V얿 zr ȴ.

偓 DSO Ϟü(shared objects) Ȥ@ DSO HƶO θO, (Ģ Ɠ@ foo.so) H Ȯھb ϞӴ. Hϵ@ α׷ ü 丮 ġ[O α׷ ڵڷ ʾb. _ α׷@ C dlopen()@ ȝ~[ DSO ּҰ н鿩 Ѵ. V α׷@ DSO݋ U@ ã ʾb. _ տ݋ Ϟ[z δb ڵڷ Hϰ Hϓ ƹ н DSO ƺ\(Ư H Z[b libc.so U)݋ DSO ( oã@) U@ ãb. E݋ DSOb ġ Q α׷ rڷ rȰͰ H U@ ˰Եȴ.

DSO API ƃ~[݋ ڷ α׷@ dlsym()ڷ DSO݋ Ưr U@ ã݋, ՙڷ ȝ~[ zġ(dispatch) F vѴ. ٸ α׷@ ȝ~ Ǻ@ ãƾѴ. Ʒ 䟒 @ α׷ Ϻθ α׷ ʿVM н ʾƙn (E݋ ޸𸮸 [ ʰ) ȴپb ƴ. ⺻ α׷ @ Ȯ[ ʿ κ@ ڷ н ] .

Ʒ DSO 䟒 ڿz , Ѱ. α׷@ Ȯ[ DSO ȝ~V DSO α׷ U@ ãb ϓƴ. ? DSO α׷ U@ "_ڷ ãb "@ (ƺ\b _@ ȝ~[b α׷ 𸥴پb) ƺ\ 迡 ^[, E݋ ʽO Fȭn ʾұ V얓ƴ. H _U(global symbol)@ zh(export) ʱV얿 DSO ȝ~ ] ^. DSO ȝ~[ α׷@ Ȯ[R Ŀ _U@ zh[nU K[b ͓ ֵ ذåƴ.

Ϟƺ\b DSO Ҏe Ģ ƱV얿 ü [b v ƺ\ ȝ~Ѵ. ^ @ α׷@ α׷@ Ȯ[ Ϟü ȝ~[ ʾb.

1998 @ Ȯ[ DSO 䟒 ȝ~ h Űb (XS 䟒 DynaLoader @ ȝ~) Perl 5, Netscape Server ڷ 幰. Hġb ƹ @ Ȯ[ @ ȝ~߽O ܺ @ Hġ Uɿ [ ڷ zġU@ ƃ~ Ҏ^@ ȝ~߱V얿 1.3 L P Jߴ. E݋ Hġb @ нƾb DSO ȝ~[nU rĘ.

top

Z

տ݋ DSO ȝ~[R ٞ @ :

DSOb ٞ @ Z :

:  en  |  fr  |  ja  |  ko  |  tr 

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.
С͸