÷ƒ’À;è TeX output 2006.06.02:0228‹/ÿÿÿÿ‘·ºâŸ·ºâòO! /DvipsToPDF { 72.27 mul Resolution div } def /PDFToDvips { 72.27 div Resolution mul } def /HyperBorder { 1 PDFToDvips } def /H.V {pdf@hoff pdf@voff null} def /H.B {/Rect[pdf@llx pdf@lly pdf@urx pdf@ury]} def /H.S { currentpoint HyperBorder add /pdf@lly exch def dup DvipsToPDF /pdf@hoff exch def HyperBorder sub /pdf@llx exch def } def /H.L { 2 sub dup /HyperBasePt exch def PDFToDvips /HyperBaseDvips exch def currentpoint HyperBaseDvips sub /pdf@ury exch def /pdf@urx exch def } def /H.A { H.L currentpoint exch pop vsize 72 sub exch DvipsToPDF HyperBasePt sub sub /pdf@voff exch def } def /H.R { currentpoint HyperBorder sub /pdf@ury exch def HyperBorder add /pdf@urx exch def currentpoint exch pop vsize 72 sub exch DvipsToPDF sub /pdf@voff exch def } def systemdict /pdfmark known not {userdict /pdfmark systemdict /cleartomark get put} if ïþps:SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if endï˜ps:SDict begin [ /Title () /Subject () /Creator (LaTeX with hyperref package) /Author () /Producer (dvips + Distiller) /Keywords () /DOCINFO pdfmark end ç ýU‘Hïcolor push Blackïcolor push gray 0ïps:SDict begin H.S endïcolor push gray 0ï color popŽïps:SDict begin H.R endïJps:SDict begin [ /View [/XYZ H.V] /Dest (page.1) cvn H.B /DEST pdfmark endï color popŽ’Ôï color popŽŽ { þ¾=k‘H þÑ•ïTps:SDict begin [ /Page 1 /View [ /Fit ] /PageMode /UseOutlines /DOCVIEW pdfmark endï1ps:SDict begin [ {Catalog} << >> /PUT pdfmark endïps:SDict begin H.S endïps:SDict begin 12 H.A endïMps:SDict begin [ /View [/XYZ H.V] /Dest (Doc-Start) cvn H.B /DEST pdfmark endïpapersize=0.0pt,0.0ptïps:SDict begin H.S endïps:SDict begin 12 H.A endïEps:SDict begin [ /View [/XYZ H.V] /Dest (0) cvn H.B /DEST pdfmark endŸ&ñ‘o-çóúâ phvb8t¾C++–êÏdlopen“mini“HO‘þÁWT‘ÿBOŽŸ!C–’ÊgóúG® phvb8t¿Aar§Œon‘ͽIsottonŽ¤’Éî3óú phvb8tÀaar“on@isotton.comŽ¡Ÿ ’ãPý2006-03-16ŽŸõÑ0Diario–Uüdelle“ReÑóvisioniŽŸ¦aïps:SDict begin H.S endïps:SDict begin 0 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (table.1) cvn H.B /DEST pdfmark endŸÿþ‘0óáÚŽ phvr8tÁRe³7visione‘ǧ1.10Ž‘tVÝ2006-03-16Ž’©úRe³7visionato–ǧda:“AIŽŽ¤ 4u‘0Cambio–ǧdi“licenza“da“GFDL“a“GPL.“Corretta“la“spiegazione“dell'uso“di“dlerror‘ÿÿ,“al“rš&_iguardo“si“r˜ing•ægr“azia–ǧCar?ÿmelo“PiccioneÙ .“Esempio“d'uso“di“un“virf`tual“destr˜uctor‘ÿÿ,“in“mater˜ia“si“r˜ing•ægr“azia–ǧJoerg“KnobÌÐloch.“Aggiunta“la“sezione“Sorgenti.“Correzioni“minor˜i.ŽŽ© 9–‘0Re³7visione‘ǧ1.03Ž‘tVÝ2003-08-12Ž’©úRe³7visionato–ǧda:“AIŽŽ¡‘0Inclusa–ǧmenzione“del“Dynamic“Module“Loader“GLib™Ÿ.“Si“rš&_ing•ægr“azia–ǧG.“V‘þÀ.“Sr˜irægaam“per“il“sugger˜imento™Ÿ.ŽŽ¦‘0Re³7visione‘ǧ1.02Ž‘tVÝ2002-12-08Ž’©úRe³7visionato–ǧda:“AIŽŽ¡‘0Aggiunta–ǧuna“F‘ÿ37A³7Q.“Altre“modiche“minor&_i.ŽŽ¦‘0Re³7visione‘ǧ1.01Ž‘tVÝ2002-06-30Ž’©úRe³7visionato–ǧda:“AIŽŽ¡‘0Aggior?ÿnamento–ǧdel“materš&_iale“sui“virf`tual“destr˜uctor‘ÿÿ.“Altre“modiche“minor˜i.ŽŽ¦‘0Re³7visione‘ǧ1.00Ž‘tVÝ2002-06-19Ž’©úRe³7visionato–ǧda:“AIŽŽ¡‘0Spostato–ǧil“cop³7yrš&_ight“e“la“licenza“all'inizio“del“documento™Ÿ.“Aggiunta“la“sezione“r˜iguardante“i“ter?ÿmini“impiegati“in“questo“documento™Ÿ.“Altre“modiche“minor˜i.ŽŽ¦‘0Re³7visione‘ǧ0.97Ž‘tVÝ2002-06-19Ž’©úRe³7visionato–ǧda:“JYGŽŽ¡‘0Modiche–ǧminorš&_i“r˜iguardanti“la“g•ægr“ammatica–ǧe“la“str˜utturšæga“delle“fr˜asi.ŽŽ¦‘0Re³7visione‘ǧ0.96Ž‘tVÝ2002-06-12Ž’©úRe³7visionato–ǧda:“AIŽŽ¡‘0Aggiunta–ǧla“bibÌÐliog•ægr“aa.–ǧCorretta“la“spiegazione“delle“funzioni“e“vÀar&_iabili“e³7xter?ÿn.ŽŽ¦‘0Re³7visione‘ǧ0.95Ž‘tVÝ2002-06-11Ž’©úRe³7visionato–ǧda:“AIŽŽ¡‘0Modiche‘ǧminor&_i..ŽŽŽŸ*÷ ’‰€ó?Á|‰ ptmr8t½Come–€caricare“dinamicamente“funzioni“e“classi“C++“per“mezzo“dell'interfægaccia“ó‰š pcrr8tÂdlopen½.Ž¤ ’‰€T¦graduzione–€a“cura“di“Federico“Lucifredi“,“Harv˜ard“Uni˜vÙ ersity‘ÿY .ŽŸ@Ÿ‘Mïps:SDict begin H.S endïps:SDict begin 13 H.A endïIps:SDict begin [ /View [/XYZ H.V] /Dest (intro) cvn H.B /DEST pdfmark endŽŸ-lŒ‘H¿1.‘ͽIntr§Œoduzioneïps:SDict begin H.S endïps:SDict begin 22.464 H.A endïIps:SDict begin [ /View [/XYZ H.V] /Dest (0.1.1) cvn H.B /DEST pdfmark endŽ‘HŸ7Eïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (56) cvn H.B /DEST pdfmark endŸ È»‘0½Una–fydomanda›fxspesso“posta˜da“programmatori˜C++“che˜sviluppano“sotto˜Unix“riguarda˜il“come˜si“procedaŽ¡‘0al–€caricamento“di“funzioni“e“classi“C++“dinamicamente“per“mezzo“dell'API“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (57) cvn H.B /DEST pdfmark endÂdlopen½.Ž©*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (58) cvn H.B /DEST pdfmark endŸ ÕÈ‘0In–€pratica,“fægar“ci€ò“non“€è“sempre“semplice“e“qualche“spiešÙ gó7azione“in“merito“sembra“do˜vuta“-“questo“€èŽ¡‘0l'obiettiÀvÌÐo–€di“questo“documento.Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (59) cvn H.B /DEST pdfmark endŸ ÕÈ‘0Una–€conoscenza“intermedia“dei“linguaggi“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (60) cvn H.B /DEST pdfmark endC“e“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (61) cvn H.B /DEST pdfmark endC++“e“dell'API“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (62) cvn H.B /DEST pdfmark endÂdlopen“½sono“necessari“per“poterŽ¡‘0comprendere–€appieno“il“documento.Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (63) cvn H.B /DEST pdfmark endŸ ÕÈ‘0La–€všÙ ersione“originale“di“questo“documento“pu€ò“essere“consultata“online“al“se˜guente“URL:ŽŽŸ0‘Hïcolor push Black’Ïóϯ8 ptmri8tÃ1ŽŽŽŽŽŽŽ’Ôï color popŽŽŒ‹/*‘·ºâŸ·ºâïþps:SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end ç ýU‘Hïcolor push Blackïcolor push gray 0ïps:SDict begin H.S endïcolor push gray 0ï color popŽïps:SDict begin H.R endïJps:SDict begin [ /View [/XYZ H.V] /Dest (page.2) cvn H.B /DEST pdfmark endï color popŸüfd’huìÃC++–€dlopen“mini“HO‘ÿÿWTÑðOŽŽŽŽŽŽŽ’Ôï color popŽŽ { ýš‘xïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (64) cvn H.B /DEST pdfmark end½http://www‘ÿY .isotton.com/hoÀwtos/C++-dlopen-mini-HO¦gWTÑðO/.Ž‘HŸ*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïMps:SDict begin [ /View [/XYZ H.V] /Dest (copyright) cvn H.B /DEST pdfmark end©%Zç‘0óúff phvb8tÄ1.1.–ÈCopȽyright“e“Licenza“(in“originale“inglese)ïps:SDict begin H.S endïps:SDict begin 18.72 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (0.1.1.2) cvn H.B /DEST pdfmark endŽŸ41ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (67) cvn H.B /DEST pdfmark endŸ ËÏ‘0½This–€document,“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (68) cvn H.B /DEST pdfmark endÃC++“dlopen“mini“HO‘ÿÿWTÑðO½,“is“copægyrighted“(c)“2002-2006“by“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (69) cvn H.B /DEST pdfmark endÃAarŒÏon“Isotton½.“PermissionŽ¤ ‘0is–€granted“to“copægy‘ÿY ,“distribÌÐute“and/or“modify“this“document“under“the“terms“of“the“GNU“General“PublicŽ¡‘0License,–€V‘þã×ersion“2,“as“published“by“the“Free“Softwægare“FÙ oundation.ŽŸj8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïNps:SDict begin [ /View [/XYZ H.V] /Dest (disclaimer) cvn H.B /DEST pdfmark end¦‘0Ä1.2.‘ÈLiberatoriaïps:SDict begin H.S endïps:SDict begin 18.72 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (0.1.2.2) cvn H.B /DEST pdfmark endŽŸ.ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (72) cvn H.B /DEST pdfmark endŸ Ñò‘0½Non–€si“pu€ò“accettare“responsabilit€à“per“i“contenuti“di“questo“documento.“L‘ÿ'uso“di“concetti,“casi“diŽ¡‘0esempio–€e“di“informazione“iÀvi“contenuti“€è“interamente“a“rischio“dell'utente.“Questo“documento“pu€òŽ¡‘0contenere–€errori“o“informazioni“inaccurate“che“possono“causar“danno“al“sistema.“Si“proceda“con“cautela,Ž¡‘0e–€nonostante“tutto“ci€ò“sia“estremamente“improbabile,“l'autore“non“si“assume“alcuna“responsabilit€à.ŽŸ*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (73) cvn H.B /DEST pdfmark endŸ ÕÈ‘0TŒÏutti–€i“copšægyright“sono“mantenuti“dai“rispettiÀvi“proprietari,“eccezion“f˜atta“per“i“casi“in“cui“si“indicaŽ¡‘0dišÀvÙ ersamente.–€L‘ÿ'uso“di“un“termine“in“questo“documento“non“de˜všÙ e“essere“considerato“come“aÌÐv˜ente“eettoŽ¡‘0sulla–€všÀalidit€à“di“qualsiasi“marchio“reÙ gistrato.“La“menzione“di“particolari“prodotti“o“marche“non“de˜vÙ eŽ¡‘0essere–€considerato“come“una“indicazione“di“preferenza“dell'autore“per“tal“prodotto.ŽŸj8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (credits) cvn H.B /DEST pdfmark end¦‘0Ä1.3.–ÈRingraziamenti“a“Colorš¶Jo“Che“Hanno“Contrib˜uitoïps:SDict begin H.S endïps:SDict begin 18.72 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (0.1.3.2) cvn H.B /DEST pdfmark endŽŸ41ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (76) cvn H.B /DEST pdfmark endŸ ËÏ‘0½In–€questo“documento,“l'autore“ha“il“piacere“di“riconoscere“il“contribÌÐuto“riceÀvuto“da“(in“ordineŽ¡‘0strettamente–€alfægabetico)“:ŽŸÊ8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (77) cvn H.B /DEST pdfmark endŸ@ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (78) cvn H.B /DEST pdfmark endŸuÈ‘0ïcolor push BlackóXlï' ptmr8cÆ€ˆï color popŽŽ‘:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (79) cvn H.B /DEST pdfmark end½Joægy–€Y“Goodreau“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (80) cvn H.B /DEST pdfmark end<Âjoyg–ff(at)“us.ibm.com½>–€per“il“suo“la•ÌÐv“oro–€di“reÀvisione“editoriale.ŽŸ*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (81) cvn H.B /DEST pdfmark endŸÕÈ‘0ïcolor push BlackÆ€ˆï color popŽŽ‘:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (82) cvn H.B /DEST pdfmark end½D.–€Stimitis“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (83) cvn H.B /DEST pdfmark end<Âstimitis–ff(at)“idcomm.com½>–€per“aÌÐvÙ er“portato“all'attenzione“dell'autore“alcuneŽ¡‘:sottigliezze–€riguardanti“il“processo“di“decorazione“dei“simboli“(name“mangling)“e“della“clausolaŽ¡‘:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (84) cvn H.B /DEST pdfmark endÂextern‘ff"C"½.Žž#´ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (85) cvn H.B /DEST pdfmark endŸÜL‘0ïcolor push BlackÆ€ˆï color popŽŽ‘:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (86) cvn H.B /DEST pdfmark end½Numerosi–€altri“hanno“indicato“errori“o“dato“suggerimenti“per“migliorare“questo“documento.“V‘þµÇoi“sapeteŽ¡‘:chi‘€siete!ŽŸ”ïps:SDict begin H.S endïps:SDict begin 13 H.A endïLps:SDict begin [ /View [/XYZ H.V] /Dest (feedback) cvn H.B /DEST pdfmark endŸ'k‹‘0Ä1.4.‘ÈCommentiïps:SDict begin H.S endïps:SDict begin 18.72 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (0.1.4.2) cvn H.B /DEST pdfmark endŽŸ.ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (89) cvn H.B /DEST pdfmark endŸ Ñò‘0½L‘ÿ'autore–€apprezza“i“commenti“del“lettore,“che“possono“essere“in™Ÿviati“al“seÙ guente“indirizzo“e-mail:Ž¡‘0ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (90) cvn H.B /DEST pdfmark end<Âaaron@isotton.com½>.ŽŸc´ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (91) cvn H.B /DEST pdfmark endŽŸ0‘Hïcolor push Black’ÏÃ2ŽŽŽŽŽŽŽ’Ôï color popŽŽŒ‹/ב·ºâŸ·ºâïþps:SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end ç ýU‘Hïcolor push Blackïcolor push gray 0ïps:SDict begin H.S endïcolor push gray 0ï color popŽïps:SDict begin H.R endïJps:SDict begin [ /View [/XYZ H.V] /Dest (page.3) cvn H.B /DEST pdfmark endï color popŸüfd’huìÃC++–€dlopen“mini“HO‘ÿÿWTÑðOŽŽŽŽŽŽŽ’Ôï color popŽŽ { ýš9‘xÄ1.5.–ÈT‘ÿ"Òermini“Usati“in“Questo“Documentoïps:SDict begin H.S endïps:SDict begin 18.72 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (0.1.5.2) cvn H.B /DEST pdfmark endŽ‘HŸ¿¨ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (93) cvn H.B /DEST pdfmark end©ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (95) cvn H.B /DEST pdfmark endïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (96) cvn H.B /DEST pdfmark endŸ @X‘0Âdlopen‘€½APIŽŸbÌïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (97) cvn H.B /DEST pdfmark endŸ4‘0ïcolor push Black‘€ï color popŽŽ‘Dïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (98) cvn H.B /DEST pdfmark endL‘ÿ'insieme–€delle“funzioni“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïFps:SDict begin [ /View [/XYZ H.V] /Dest (99) cvn H.B /DEST pdfmark endÂdlclose½,“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (100) cvn H.B /DEST pdfmark endÂdlerror½,“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (101) cvn H.B /DEST pdfmark endÂdlopen“½e“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (102) cvn H.B /DEST pdfmark endÂdlsym“½come“descritte“nella“paginaŽ¤ ‘Dïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (103) cvn H.B /DEST pdfmark endÂdlopen(3)–€½di“man.ŽŸbÌïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (104) cvn H.B /DEST pdfmark endŸ 4‘DSi–€osservi“l'uso“del“termine“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (105) cvn H.B /DEST pdfmark endïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (106) cvn H.B /DEST pdfmark endÂdlopen½“con“riferimento“indiÀviduale“alla“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (107) cvn H.B /DEST pdfmark endÃfunzione“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (108) cvn H.B /DEST pdfmark endÂdlopen½,“e“deiŽ¡‘Dtermini–€ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (109) cvn H.B /DEST pdfmark endïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (110) cvn H.B /DEST pdfmark endÂdlopen“½API“e“interfægaccia“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (111) cvn H.B /DEST pdfmark endÂdlopen“½con“riferimento“all'ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (112) cvn H.B /DEST pdfmark endÃinterÙ a“API‘‚ˆ½.ŽŸ@¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïNps:SDict begin [ /View [/XYZ H.V] /Dest (theproblem) cvn H.B /DEST pdfmark endŸ-lŒ¿2.–ͽIl“Pr§ŒobÓÅlemaïps:SDict begin H.S endïps:SDict begin 22.464 H.A endïIps:SDict begin [ /View [/XYZ H.V] /Dest (0.2.1) cvn H.B /DEST pdfmark endŽŸ7Eïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (115) cvn H.B /DEST pdfmark endŸ È»‘0½T‘ÿ37alvÌÐolta–€uno“sviluppatore“pu€ò“trošÙ vÀarsi“nella“posizione“di“do˜v˜er“caricare“una“libreria“(ed“usare“le“funzioniŽ¡‘0iÀvi–€contenute)“a“runtime;“questo“accade“il“pi€ù“delle“vÌÐolte“quando“si“sta“sviluppando“un“plug-in“di“qualcheŽ¡‘0tipo–€o“un“programma“diseÙ gnato“con“una“architettura“modulare.Ž©*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (116) cvn H.B /DEST pdfmark endŸ ÕÈ‘0In–€C“caricare“una“libreria“€è“estremamente“semplice“(€è“suciente“in™ŸvÌÐocare“le“funzioni“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (117) cvn H.B /DEST pdfmark endÂdlopen½,“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (118) cvn H.B /DEST pdfmark endÂdlsym“½eŽ¡‘0ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (119) cvn H.B /DEST pdfmark endÂdlclose½),–€mentre“in“C++“l'operazione“€è“leÙ ggermente“pi€ù“complessa.“Le“dicolt€à“insite“nel“caricareŽ¡‘0dinamicamente–€una“libreria“C++“sono“in“parte“doÙ vute“al“processo“di“decorazione“dei“simboli“di“linkingŽ¡‘0comunemente–€chiamato“ïcolor push gray 0ïps:SDict begin H.S endname“manglingïps:SDict begin 13 H.L endïnps:SDict begin [ /Subtype /Link /Dest (mangling) cvn /H /I /Border [0 0 0] /Color [1 0 0] H.B /ANN pdfmark endï color popŽ‘@p|,“ed“in“parte“doÙ vute“al“fšægatto“che“l'interf˜accia“di“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (121) cvn H.B /DEST pdfmark endÂdlopen“½€è“stataŽ¡‘0implementata–€pensando“in“C“e,“conseÙ guentemente,“non“ore“una“maniera“appropriata“di“caricare“classi.Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (122) cvn H.B /DEST pdfmark endŸ ÕÈ‘0Prima–€di“illustrare“come“si“caricano“dinamicamente“le“librerie“in“C++,“€è“appropriato“analizzare“ilŽ¡‘0processo–€di“name“mangling“in“maggior“dettaglio.“Si“continui“la“lettura,“la“spieÙ gó7azione“del“processo“diŽ¡‘0decorazione–€dei“simboli“€è“importante“nel“comprendere“le“ragioni“del“problema“e“come“risolvÙ erle.ŽŸ*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïLps:SDict begin [ /View [/XYZ H.V] /Dest (mangling) cvn H.B /DEST pdfmark endŸ%Zç‘0Ä2.1.–ÈName“Manglingïps:SDict begin H.S endïps:SDict begin 18.72 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (0.2.6.2) cvn H.B /DEST pdfmark endŽŸ41ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (125) cvn H.B /DEST pdfmark endŸ ËÏ‘0½In–€ogni“programma“C++“(o“libreria,“o“object“le),“tutte“le“funzioni“non“dichiarate“come“static“sonoŽ¡‘0rappresentate–€nel“le“binario“da“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (126) cvn H.B /DEST pdfmark endÃsimboli½.“Questi“simboli“sono“speciali“stringhe“di“testo“che“identicanoŽ¡‘0unicamente–€una“funzione“nel“programma,“la“libreria“o“l'object“le.Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (127) cvn H.B /DEST pdfmark endŸ ÕÈ‘0In–€C“il“simbolo“e“il“nome“della“funzione“corrispondono:“il“simbolo“della“funzione“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (128) cvn H.B /DEST pdfmark endÂstrcpy“½€è“appuntoŽ¡‘0ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (129) cvn H.B /DEST pdfmark endÂstrcpy½,–€e“cos€ì“per“ogni“altro“simbolo.“Questo“€è“possibile“perch€é“in“C“due“funzioni“non“dichiarate“comeŽ¡‘0static–€ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (130) cvn H.B /DEST pdfmark endÃdešÙ vono“½necessariamente“aÌÐv˜ere“nomi“distinti.ŽŸ´ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (131) cvn H.B /DEST pdfmark endŸ áL‘0Siccome–€il“linguaggio“C++“permette“l'o•Ù v“erloading–€di“una“funzione“(diÀvšÙ erse“v˜ersioni“di“una“funzioneŽ¡‘0aÌÐvÙ ente–€il“medesimo“nome“ma“una“dierente“lista“di“arÑðgomenti)“ed“include“svÀariate“funzionalit€à“nonŽ¡‘0presenti–€in“C“-“come“classi,“funzioni“che“fæganno“parte“di“dette“classi,“la“specica“di“eccezioni“-“non“€èŽ¡‘0semplicemente–€possibile“impiešÙ gó7are“il“solo“nome“della“funzione“come“unico“simbolo.“Per“risolv˜ere“questoŽŽŸ0‘Hïcolor push Black’ÏÃ3ŽŽŽŽŽŽŽ’Ôï color popŽŽŒ‹/3 ‘·ºâŸ·ºâïþps:SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end ç ýU‘Hïcolor push Blackïcolor push gray 0ïps:SDict begin H.S endïcolor push gray 0ï color popŽïps:SDict begin H.R endïJps:SDict begin [ /View [/XYZ H.V] /Dest (page.4) cvn H.B /DEST pdfmark endï color popŸüfd’huìÃC++–€dlopen“mini“HO‘ÿÿWTÑðOŽŽŽŽŽŽŽ’Ôï color popŽŽ { ýš‘x½problema,–€il“C++“utilizza“il“cosiddetto“meccanismo“di“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (132) cvn H.B /DEST pdfmark endÃname“mangling½,“che“trasforma“il“nome“dellaŽ¤ ‘xfunzione–€e“tutte“le“informazioni“necessarie“(come“il“numero“e“la“dimensione“deÙ gli“arÑðgomenti)“in“unaŽ¡‘xstringšó7a–€di“testo“cos€ì“ing˜arbÌÐugliata“che“solo“il“compiler“riesce“a“comprenderla.“Il“simbolo“risultante“per“laŽ¡‘xfunzione–€ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (133) cvn H.B /DEST pdfmark endÂfoo“½potrebbe“ad“esempio“essere“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (134) cvn H.B /DEST pdfmark endÂfoo@4%6^“½-“o“potrebbe“non“includere“nemmeno“la“parolaŽ¡‘xïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (135) cvn H.B /DEST pdfmark endfoo.Ž‘H©”ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (136) cvn H.B /DEST pdfmark endŸ æl‘0Uno–fydei›fzproblemi“risultanti“dal“processo˜di“name“mangling“€è˜che“lo“standard“C++˜(currently“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (137) cvn H.B /DEST pdfmark end[ISO14882])Ž¡‘0non–€denisce“come“i“simboli“debbano“essere“codicati.“Di“conseÙ guenza,“ogni“compiler“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (138) cvn H.B /DEST pdfmark enddecora“iŽ¡‘0simboli–€in“maniera“diÀvÙ ersa,“alcuni“compiler“hanno“addirittura“cambiato“l'algoritmo“di“name“mangling“traŽ¡‘0diÀvšÙ erse–€release“(fægamoso“il“caso“di“g++“2.x“e“3.x).“Anche“se“aÌÐv˜este“studiato“i“dettagli“del“processo“di“nameŽ¡‘0mangling–€del“vÌÐostro“compiler“(e“quindi“sareste“in“grado“di“caricare“funzioni“per“mezzo“di“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (139) cvn H.B /DEST pdfmark endÂdlsym½),“questaŽ¡‘0soluzione–€risulterebbe“funzionare“solamente“con“quel“particolare“compiler™Ÿ,“ed“il“meccanismo“potrebbeŽ¡‘0non–€funzionare“gi€à“con“la“prossima“vÙ ersione“del“medesimo.ŽŸj8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (140) cvn H.B /DEST pdfmark endŸ%Zç‘0Ä2.2.‘ÈClassiïps:SDict begin H.S endïps:SDict begin 18.72 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (0.2.7.2) cvn H.B /DEST pdfmark endŽŸ.ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (142) cvn H.B /DEST pdfmark endŸ Ñò‘0½Un–€altro“problema“dell'interfšægaccia“denita“da“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (143) cvn H.B /DEST pdfmark endÂdlopen“½€è“la“limitazione“inerente“nel“f˜atto“che“la“libreriaŽ¡‘0supporta–€solamente“il“caricamento“di“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (144) cvn H.B /DEST pdfmark endÃfunzioni½.“Ma“in“C++“una“libreria“spesso“espone“la“denizione“diŽ¡‘0classi–€da“utilizzare“nei“nostri“programmi.“Ovviamente,“per“poter“utilizzare“queste“ultime“si“deÀvÙ e“essere“inŽ¡‘0grado–€di“istanziare“le“medesime,“ma“questo“non“€è“fšægacilmente“f˜attibile.ŽŸ j8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïOps:SDict begin [ /View [/XYZ H.V] /Dest (thesolution) cvn H.B /DEST pdfmark endŸ+BT¿3.–ͽLa“Soluzioneïps:SDict begin H.S endïps:SDict begin 22.464 H.A endïIps:SDict begin [ /View [/XYZ H.V] /Dest (0.3.1) cvn H.B /DEST pdfmark endŽž7Eïps:SDict begin H.S endïps:SDict begin 13 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (externC) cvn H.B /DEST pdfmark endŸ'MÚ‘0Ä3.1.‘Èó‰š õà pcrb8tÇextern‘ƨ"C"ïps:SDict begin H.S endïps:SDict begin 18.72 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (0.3.8.2) cvn H.B /DEST pdfmark endŽŸBVïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (150) cvn H.B /DEST pdfmark endŸ ½ª‘0½In–€C++,“una“k•ægešÙ yw“ord–€indica“che“una“funzione“deÀv˜e“impie˜gó7are“la“con™Ÿv˜enzione“di“linking“(il“termineŽ¡‘0comunemente–€usato“€è“"binding"“-“N.d.T‘ÿB.)“usata“in“C:“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (151) cvn H.B /DEST pdfmark endÂextern‘ff"C"½.“Una“funzione“dichiarata“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (152) cvn H.B /DEST pdfmark endÂexternŽ¡‘0"C"–€½viene“rappresentata“da“un“simbolo“coincidente“con“il“nome“della“funzione,“esattamente“come“in“C.Ž¡‘0Per–€questa“ragione,“solo“funzioni“che“non“sono“metodi“di“una“classe“possono“essere“dichiarate“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (153) cvn H.B /DEST pdfmark endÂexternŽ¡‘0"C"½,–€e“non“possono“essere“o•Ù v“erloaded.ŽŸ*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (154) cvn H.B /DEST pdfmark endŸ ÕÈ‘0Nonostante–€le“serie“limitazioni,“funzioni“dichiarate“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (155) cvn H.B /DEST pdfmark endÂextern‘ff"C"“½sono“estremamente“utili“nel“nostroŽ¡‘0scenario–€perch€é“possono“essere“caricate“dinamicamente“utilizzando“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (156) cvn H.B /DEST pdfmark endÂdlopen“½esattamente“come“unaŽ¡‘0funzione‘€C.Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (157) cvn H.B /DEST pdfmark endŸ æl‘0Questo–€ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (158) cvn H.B /DEST pdfmark endÃnon“½signica“che“una“funzione“dichiarata“come“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (159) cvn H.B /DEST pdfmark endÂextern‘ff"C"“½non“pu€ò“contenere“codice“C++.Ž¡‘0T‘ÿ37ale–€funzione“€è“una“funzione“C++“a“tutti“gli“eetti,“che“pu€ò“utilizzare“le“funzionalit€à“del“linguaggio“C++Ž¡‘0e–€riceÀvÙ ere“qualunque“tipo“di“arÑðgomento“il“programmatore“desideri.ŽŸj8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïTps:SDict begin [ /View [/XYZ H.V] /Dest (loadingfunctions) cvn H.B /DEST pdfmark endŽŸ0‘Hïcolor push Black’ÏÃ4ŽŽŽŽŽŽŽ’Ôï color popŽŽŒ‹/T„‘·ºâŸ·ºâïþps:SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end ç ýU‘Hïcolor push Blackïcolor push gray 0ïps:SDict begin H.S endïcolor push gray 0ï color popŽïps:SDict begin H.R endïJps:SDict begin [ /View [/XYZ H.V] /Dest (page.5) cvn H.B /DEST pdfmark endï color popŸüfdŸ÷™œïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (171) cvn H.B /DEST pdfmark endŸfd’huìÃC++–€dlopen“mini“HO‘ÿÿWTÑðOŽŽŽŽŽŽŽ’Ôï color popŽŽ { ýš9‘xÄ3.2.–ÈCaricare“Funzioniïps:SDict begin H.S endïps:SDict begin 18.72 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (0.3.9.2) cvn H.B /DEST pdfmark endŽ‘HŸ.ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (162) cvn H.B /DEST pdfmark endŸ Ñò‘0½In–€C++“le“funzioni“vÙ engono“caricate“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (163) cvn H.B /DEST pdfmark endÃesattamente“½come“in“C,“con“una“chiamata“a“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (164) cvn H.B /DEST pdfmark endÂdlsym½,“ma“le“funzioniŽ¤ ‘0che–€saranno“caricate“dešÀvÌÐono“essere“qualicate“con“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (165) cvn H.B /DEST pdfmark endÂextern‘ff"C"“½per“e˜vitare“che“i“simboli“vÙ engó7anoŽ¡‘0decorati.Žž”ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (166) cvn H.B /DEST pdfmark endŸ&l‘0óª,« ptmb8tÈEsempio–€1.“CaricarÑðe“una“FunzioneŽŸ¬ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (168) cvn H.B /DEST pdfmark endŸ øT‘0½main.cpp:ŽŸj8ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (169) cvn H.B /DEST pdfmark endŸ ˆû‘0Â#include‘ffŽ¤ ³3‘0#include‘ffŽ¡¡‘0int–ffmain()“{Ž¡‘E™˜using‘ffstd::cout;Ž¡‘E™˜using‘ffstd::cerr;Ž¡¡‘E™˜cout–ff<<“"C++“dlopen“demo\n\n";Ž¡¡‘E™˜//–ffopen“the“libraryŽ¡‘E™˜cout–ff<<“"Opening“hello.so...\n";Ž¡‘E™˜void*–ffhandle“=“dlopen("./hello.so",“RTLD_LAZY);Ž¡¡‘E™˜if–ff(!handle)“{Ž¡‘[30cerr–ff<<“"Cannot“open“library:“"“<<“dlerror()“<<“'\n';Ž¡‘[30return‘ff1;Ž¡‘E™˜}Ž¡¡‘E™˜//–ffload“the“symbolŽ¡‘E™˜cout–ff<<“"Loading“symbol“hello...\n";Ž¡‘E™˜typedef–ffvoid“(*hello_t)();Ž¡¡‘E™˜//–ffreset“errorsŽ¡‘E™˜dlerror();Ž¡‘E™˜hello_t–ffhello“=“(hello_t)“dlsym(handle,“"hello");Ž¡‘E™˜const–ffchar“*dlsym_error“=“dlerror();Ž¡‘E™˜if–ff(dlsym_error)“{Ž¡‘[30cerr–ff<<“"Cannot“load“symbol“'hello':“"“<<“dlsym_error“<<Ž¡‘pÌÈ'\n';Ž¡‘[30dlclose(handle);Ž¡‘[30return‘ff1;Ž¡‘E™˜}Ž¡¡‘E™˜//–ffuse“it“to“do“the“calculationŽ¡‘E™˜cout–ff<<“"Calling“hello...\n";Ž¡‘E™˜hello();Ž¡¡‘E™˜//–ffclose“the“libraryŽ¡‘E™˜cout–ff<<“"Closing“library...\n";Ž¡‘E™˜dlclose(handle);Ž¡‘0}ŽŽŸ0‘Hïcolor push Black’ÏÃ5ŽŽŽŽŽŽŽ’Ôï color popŽŽŒ‹/pV‘·ºâŸ·ºâïþps:SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end ç ýU‘Hïcolor push Blackïcolor push gray 0ïps:SDict begin H.S endïcolor push gray 0ï color popŽïps:SDict begin H.R endïJps:SDict begin [ /View [/XYZ H.V] /Dest (page.6) cvn H.B /DEST pdfmark endï color popŸüfd’huìÃC++–€dlopen“mini“HO‘ÿÿWTÑðOŽŽŽŽŽŽŽ’Ôï color popŽŽ {‘H ýïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (170) cvn H.B /DEST pdfmark endŸ ‘0½hello.cpp:ŽŸ ó3‘0Â#include‘ffŽ¤ ³3¡‘0extern–ff"C"“void“hello()“{Ž¡‘E™˜std::cout–ff<<“"hello"“<<“'\n';Ž¡‘0}ŽŸýoïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (172) cvn H.B /DEST pdfmark endŸ ‘‘0½La–€funzione“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (173) cvn H.B /DEST pdfmark endÂhello½,“denita“in“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (174) cvn H.B /DEST pdfmark endÂhello.cpp“½come“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (175) cvn H.B /DEST pdfmark endÂextern‘ff"C"½,“viene“caricata“in“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (176) cvn H.B /DEST pdfmark endÂmain.cpp“½con“laŽ¤ ‘0chiamata–€a“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (177) cvn H.B /DEST pdfmark endÂdlsym½.“La“funzione“deÀvÙ e“essere“dichiarata“come“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (178) cvn H.B /DEST pdfmark endÂextern‘ff"C"“½perch€é“altrimenti“nonŽ¡‘0sapremmo–€come“ricostruire“il“simbolo“corrispondente“al“suo“nome.ŽŸ*8ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (179) cvn H.B /DEST pdfmark endŽŸ0‘Hïcolor push Black’ÎÊ@Ã6ŽŽŽŽŽŽŽ’Ôï color popŽŽŒ‹/}‘·ºâŸ·ºâïþps:SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end ç ýU‘Hïcolor push Blackïcolor push gray 0ïps:SDict begin H.S endïcolor push gray 0ï color popŽïps:SDict begin H.R endïJps:SDict begin [ /View [/XYZ H.V] /Dest (page.7) cvn H.B /DEST pdfmark endï color popŸüfd’huìÃC++–€dlopen“mini“HO‘ÿÿWTÑðOŽŽŽŽŽŽŽ’Ôï color popŽŽ {Ÿ‚ˆã’¢ þw‰R õmÜ„õmÜŸû þ!øV‘y"óÄA‘ÿl”vverIµtimentoŽ‘Ÿ.ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (180) cvn H.B /DEST pdfmark endŸ …%óáÚŽ phvr8tÊEsistono–|jdue“vÆfersioni“diºåerenti“della“dichiarèöazione“ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (181) cvn H.B /DEST pdfmark endó ‰šš pcrr8tËextern‘Ü)"C"Ê:“la“summenzionataŽ¤ ³3vÆfersione–€}ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (182) cvn H.B /DEST pdfmark endËextern›Ü)"C"Ê,“e“la“corr"‰ispondente“ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (183) cvn H.B /DEST pdfmark endËextern˜"C"˜{˜...˜}“Êcon“leŽ¡dichiaršèöazioni–€}in“parentesi“g˜r˜aºåešÝv.“La“pr"‰ima“vÆfersione˜,“detta“inline˜,“indica“linkingŽ¡ester9™no–€}secondo“la“conÑîvšÆfenzione“Cºå,“mentre“la“seconda“v˜ersione“ha“eºåetto“solo“sulŽ¡linking–€}del“linguaggio£Ü.“Le“due“dichiarèöazioni“seguenti“sono“quindi“equivÆfalenti:‘úïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (184) cvn H.B /DEST pdfmark endŽŸ¢ïps:SDict begin H.S endïps:SDict begin 10.53 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (185) cvn H.B /DEST pdfmark endŸ‡ ‘FËextern–Ü)"C"“int“foo;Ž¤ ‡®‘Fextern–Ü)"C"“void“bar();Ž¡©³3Êe‘úïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (186) cvn H.B /DEST pdfmark endŽŸzïps:SDict begin H.S endïps:SDict begin 10.53 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (187) cvn H.B /DEST pdfmark endŸ m4‘FËextern–Ü)"C"“{Ž¡‘^LÍextern–Ü)int“foo;Ž¡‘^LÍextern–Ü)void“bar();Ž¡‘F}Ž¦ÊDato–€}che“non“c'€è“diºåerenza“tršèöa“una“funzione“dichiar˜ata“con“ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (188) cvn H.B /DEST pdfmark endËextern“Êed“unaŽ¤ ³3dichiaršèöata–€}senza,“la“diºåerenza“tr˜a“i“due“stili“non“€è“r"‰ileºåvÆfanteÝv,“purch€é“non“si“stianoŽ¡dichiaršèöando–€}vÆfar"‰iabili.“Se“si“dichiar˜ano“delle“ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (189) cvn H.B /DEST pdfmark endó!áÚŽ phvro8tÌvÆfar"‰iabili‘ÄýÊ,“non“dimenticare“che‘úïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (190) cvn H.B /DEST pdfmark endŽŸTüïps:SDict begin H.S endïps:SDict begin 10.53 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (191) cvn H.B /DEST pdfmark endŸ 2²‘FËextern–Ü)"C"“int“foo;Ž¦Êe‘úïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (192) cvn H.B /DEST pdfmark endŽ©zïps:SDict begin H.S endïps:SDict begin 10.53 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (193) cvn H.B /DEST pdfmark endŸ m4‘FËextern–Ü)"C"“{Ž¤ ‡®‘Yp¤int‘Ü)foo;Ž¡‘F}ŽŸäïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (194) cvn H.B /DEST pdfmark endŸÏÌnon‘¦|Êsono–€}la“stessa“cosa.Ž¦ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (195) cvn H.B /DEST pdfmark endŸ ˜¹PŒÌer›€}ulter•"‰ior“i˜chiar“imenti,˜si˜fºåaccia˜r“ifºåer“imento˜a˜ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (196) cvn H.B /DEST pdfmark end[ISO14882]˜7.5,˜prestandoŽ¤ ³3par\#ticolare–€}attenzione“al“par•èöag“r“afšºåo–€}7,“oppure“si“consulti“ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (197) cvn H.B /DEST pdfmark end[STR2000]“al“par•èöag“r“af˜oŽ¡9.2.4.ŽŸ/8ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (198) cvn H.B /DEST pdfmark endŸ ƒûPr"‰ima–€}di“fšºåar“cose“troppo“f˜antasiose“con“vÆfar"‰iabili“e˜xter9™n,“dare“una“scorsa“aiŽ¡documenti–€}elencati“nella“sezione“ïcolor push gray 0ïps:SDict begin H.S endapprofºåondimentoïps:SDict begin 11.7 H.L endïmps:SDict begin [ /Subtype /Link /Dest (seealso) cvn /H /I /Border [0 0 0] /Color [1 0 0] H.B /ANN pdfmark endï color popŽ‘EÄ].ŽŽŽŽ’N„õmÜŽŸ‰RŽŽŽŽ‘HŸ$ùïps:SDict begin H.S endïps:SDict begin 13 H.A endïRps:SDict begin [ /View [/XYZ H.V] /Dest (loadingclasses) cvn H.B /DEST pdfmark endŸ  &‘0Ä3.3.–ÈCaricare“Classiïps:SDict begin H.S endïps:SDict begin 18.72 H.A endïLps:SDict begin [ /View [/XYZ H.V] /Dest (0.3.10.2) cvn H.B /DEST pdfmark endŽŸ.ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (202) cvn H.B /DEST pdfmark endŸ Ñò‘0½Caricare–€classi“€è“un“compito“pi€ù“complesso“perch€é“non“ci“servšÙ e“solo“un“puntatore“a“funzione,“ci“serv˜eŽŸ ‘0un'ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (203) cvn H.B /DEST pdfmark endÃistanza–€½della“classe.ŽŽŸ0‘Hïcolor push Black’ΡHÃ7ŽŽŽŽŽŽŽ’Ôï color popŽŽŒ‹/…ä‘·ºâŸ·ºâïþps:SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end ç ýU‘Hïcolor push Blackïcolor push gray 0ïps:SDict begin H.S endïcolor push gray 0ï color popŽïps:SDict begin H.R endïJps:SDict begin [ /View [/XYZ H.V] /Dest (page.8) cvn H.B /DEST pdfmark endï color popŸüfd’huìÃC++–€dlopen“mini“HO‘ÿÿWTÑðOŽŽŽŽŽŽŽ’Ôï color popŽŽ {‘H ýïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (204) cvn H.B /DEST pdfmark endŸ ‘0½Non–€possiamo“istanziare“la“classe“utilizzando“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (205) cvn H.B /DEST pdfmark endÂnew“½perch€é“la“classe“non“€è“denita“nell'eseÙ guibile,“eŽ¤ ‘0perch€é,–€in“certe“circostanze,“non“ne“conosciamo“nemmeno“il“nome.Ž©*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (206) cvn H.B /DEST pdfmark endŸ ÕÈ‘0La–€soluzione“€è“nell'usare“le“propriet€à“del“polimorsmo:“deniamo“una“classe“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (207) cvn H.B /DEST pdfmark endÃinterfaccia“½di“base“conŽ¡‘0metodi–€dichiarati“virtuali“nell'eseÙ guibile“e“una“classe“di“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (208) cvn H.B /DEST pdfmark endÃimplementazione“½deri•Àv“ata–€da“questa“nel“moduloŽ¡‘0che–€vÌÐogliamo“caricare.“Solitamente“la“classe“che“dichiara“l'interfægaccia“€è“astratta“(una“classe“€è“astratta“seŽ¡‘0tutti–€i“suoi“metodi“sono“dichiarati“virtuali).ŽŸÊ8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (209) cvn H.B /DEST pdfmark endŸ 5È‘0Siccome–€il“caricamento“dinamico“di“classi“viene“generalmente“usato“per“la“creazione“di“plug-in“-“cheŽ¡‘0deÀvÌÐono–€denire“una“interfšægaccia“chiaramente“denita“-“si“sarebbe“doÙ vuto“denire“una“classe“interf˜accia“edŽ¡‘0una–€classe“di“implementazione“in“ogni“caso.Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (210) cvn H.B /DEST pdfmark endŸ ÕÈ‘0A–nquesto›mpunto,“si“deÀvÌÐono“includere“nel“modulo˜altre“due“funzioni“che“ci“assistano˜nel“caricamento,“detteŽ¡‘0funzioni–€ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (211) cvn H.B /DEST pdfmark endÃclass“factory“½(letteralmente“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (212) cvn H.B /DEST pdfmark endfægabbrica“di“classi“-“N.d.T‘ÿB.).“La“prima“di“queste“funzioni“crea“unŽ¡‘0istanza–€della“classe“e“ritorna“un“puntatore“a“tale“istanza,“mentre“l'altra“si“occupa“di“distruggere“le“classiŽ¡‘0che–€le“vÙ engono“passate.“Queste“due“funzioni“sono“dichiarate“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (213) cvn H.B /DEST pdfmark endÂextern‘ff"C"½.Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (214) cvn H.B /DEST pdfmark endŸ ÕÈ‘0Per–€utilizzare“la“classe“denita“nel“modulo,“si“carichino“le“due“funzioni“fægactory“per“mezzo“di“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (215) cvn H.B /DEST pdfmark endÂdlsymŽ¡‘0½esattamente–€come“si“€è“gi€à“illustrato“nel“precedente“ïcolor push gray 0ïps:SDict begin H.S endesempioïps:SDict begin 13 H.L endïvps:SDict begin [ /Subtype /Link /Dest (loadingfunctions) cvn /H /I /Border [0 0 0] /Color [1 0 0] H.B /ANN pdfmark endï color popŽ‘#Ô^.“Con“questo“meccanismo,“si“possonoŽ¡‘0istanziare–€e“distruggere“tante“istanze“della“classe“quante“si“desideri“aÌÐvÙ ere“a“disposizione.ŽŸ*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (217) cvn H.B /DEST pdfmark endŸÈ‘0ÈEsempio–€2.“CaricarÑðe“una“ClasseŽŸ¬ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (219) cvn H.B /DEST pdfmark endŸ øT‘0½In–€questo“esempio“una“generica“classe“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (220) cvn H.B /DEST pdfmark endÂpolygon“½dichiara“l'interfægaccia“che“la“classe“deri•Àv“ata–€ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (221) cvn H.B /DEST pdfmark endÂtriangle“½aŽ¡‘0sua–€vÌÐolta“implementa.Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (222) cvn H.B /DEST pdfmark endŸ ÕÈ‘0main.cpp:ŽŸj8ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (223) cvn H.B /DEST pdfmark endŸ ˆû‘0Â#include‘ff"polygon.hpp"Ž¤ ³3‘0#include‘ffŽ¡‘0#include‘ffŽ¡¡‘0int–ffmain()“{Ž¡‘E™˜using‘ffstd::cout;Ž¡‘E™˜using‘ffstd::cerr;Ž¡¡‘E™˜//–ffload“the“triangle“libraryŽ¡‘E™˜void*–fftriangle“=“dlopen("./triangle.so",“RTLD_LAZY);Ž¡‘E™˜if–ff(!triangle)“{Ž¡‘[30cerr–ff<<“"Cannot“load“library:“"“<<“dlerror()“<<“'\n';Ž¡‘[30return‘ff1;Ž¡‘E™˜}Ž¡¡‘E™˜//–ffreset“errorsŽ¡‘E™˜dlerror();Ž¡¡‘E™˜//–ffload“the“symbolsŽŽŸ0‘Hïcolor push Black’ÏÃ8ŽŽŽŽŽŽŽ’Ôï color popŽŽŒ‹ /œ+‘·ºâŸ·ºâïþps:SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end ç ýU‘Hïcolor push Blackïcolor push gray 0ïps:SDict begin H.S endïcolor push gray 0ï color popŽïps:SDict begin H.R endïJps:SDict begin [ /View [/XYZ H.V] /Dest (page.9) cvn H.B /DEST pdfmark endï color popŸüfd’huìÃC++–€dlopen“mini“HO‘ÿÿWTÑðOŽŽŽŽŽŽŽ’Ôï color popŽŽ { ýš’™˜Âcreate_t*–ffcreate_triangle“=“(create_t*)“dlsym(triangle,“"create");Ž¤ ³3’™˜const–ffchar*“dlsym_error“=“dlerror();Ž¡’™˜if–ff(dlsym_error)“{Ž¡’£30cerr–ff<<“"Cannot“load“symbol“create:“"“<<“dlsym_error“<<“'\n';Ž¡’£30return‘ff1;Ž¡’™˜}Ž¡¡’™˜destroy_t*–ffdestroy_triangle“=“(destroy_t*)“dlsym(triangle,“"destroy");Ž¡’™˜dlsym_error–ff=“dlerror();Ž¡’™˜if–ff(dlsym_error)“{Ž¡’£30cerr–ff<<“"Cannot“load“symbol“destroy:“"“<<“dlsym_error“<<“'\n';Ž¡’£30return‘ff1;Ž¡’™˜}Ž¡¡’™˜//–ffcreate“an“instance“of“the“classŽ¡’™˜polygon*–ffpoly“=“create_triangle();Ž¡¡’™˜//–ffuse“the“classŽ¡’™˜poly->set_side_length(7);Ž¡’£30cout–ff<<“"The“area“is:“"“<<“poly->area()“<<“'\n';Ž¡¡’™˜//–ffdestroy“the“classŽ¡’™˜destroy_triangle(poly);Ž¡¡’™˜//–ffunload“the“triangle“libraryŽ¡’™˜dlclose(triangle);Ž¡‘x}Ž‘HŸýoïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (224) cvn H.B /DEST pdfmark endŸ ‘‘0½polygon.hpp:ŽŸj8ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (225) cvn H.B /DEST pdfmark endŸ ˆû‘0Â#ifndef‘ffPOLYGON_HPPŽ¡‘0#define‘ffPOLYGON_HPPŽ¡¡‘0class–ffpolygon“{Ž¡‘0protected:Ž¡‘E™˜double‘ffside_length_;Ž¡¡‘0public:Ž¡‘E™˜polygon()Ž¡‘[30:–ffside_length_(0)“{}Ž¡¡‘E™˜virtual–ff~polygon()“{}Ž¡¡‘E™˜void–ffset_side_length(double“side_length)“{Ž¡‘[30side_length_–ff=“side_length;Ž¡‘E™˜}Ž¡¡‘E™˜virtual–ffdouble“area()“const“=“0;Ž¡‘0};Ž¡¡‘0//–ffthe“types“of“the“class“factoriesŽ¡‘0typedef–ffpolygon*“create_t();Ž¡‘0typedef–ffvoid“destroy_t(polygon*);ŽŽŸ0‘Hïcolor push Black’ÏÃ9ŽŽŽŽŽŽŽ’Ôï color popŽŽŒ‹ /±Ø‘·ºâŸ·ºâïþps:SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end ç ýU‘Hïcolor push Blackïcolor push gray 0ïps:SDict begin H.S endïcolor push gray 0ï color popŽïps:SDict begin H.R endïKps:SDict begin [ /View [/XYZ H.V] /Dest (page.10) cvn H.B /DEST pdfmark endï color popŸüfd’huìÃC++–€dlopen“mini“HO‘ÿÿWTÑðOŽŽŽŽŽŽŽ’Ôï color popŽŽ { ýš¤ ³3‘xÂ#endifŽ‘HŸI·ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (226) cvn H.B /DEST pdfmark endŸ ¶I‘0½triangle.cpp:ŽŸj8ïps:SDict begin H.S endïps:SDict begin 11.7 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (227) cvn H.B /DEST pdfmark endŸ ˆû‘0Â#include‘ff"polygon.hpp"Ž¡‘0#include‘ffŽ¡¡‘0class–fftriangle“:“public“polygon“{Ž¡‘0public:Ž¡‘E™˜virtual–ffdouble“area()“const“{Ž¡‘[30return–ffside_length_“*“side_length_“*“sqrt(3)“/“2;Ž¡‘E™˜}Ž¡‘0};Ž¡¡¡‘0//–ffthe“class“factoriesŽ¡¡‘0extern–ff"C"“polygon*“create()“{Ž¡‘E™˜return–ffnew“triangle;Ž¡‘0}Ž¡¡‘0extern–ff"C"“void“destroy(polygon*“p)“{Ž¡‘E™˜delete‘ffp;Ž¡‘0}ŽŸýoïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (228) cvn H.B /DEST pdfmark endŸ ‘‘0½Alcune–€osservÀazioni“sul“processo“di“caricamento“di“classi:Ž©*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (229) cvn H.B /DEST pdfmark endŸ@ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (230) cvn H.B /DEST pdfmark endŸÈ‘0ïcolor push BlackÆ€ˆï color popŽŽ‘:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (231) cvn H.B /DEST pdfmark end½€È–€necessario“denire“sia“una“funzione“fægactory“per“creare“istanze“della“classe“che“per“distruggerle:“siŽ¤ ‘:de•ÀvÙ e›€e“vitare˜l'uso˜dell'operatore˜ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (232) cvn H.B /DEST pdfmark endÂdelete˜½nell'eseÙ guibile˜e˜ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (233) cvn H.B /DEST pdfmark endÃsempr¡Ge˜½adarsi˜al˜modulo˜per˜distruggereŽ¡‘:la–€classe.“Questo“€è“došÙ vuto“al“fægatto“che“in“C++“gli“operatori“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (234) cvn H.B /DEST pdfmark endÂnew“½e“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (235) cvn H.B /DEST pdfmark endÂdelete“½possono“essere“o˜v˜erloaded,Ž¡‘:il–€che“pu€ò“condurre“ad“una“situazione“in“cui“le“chiamate“a“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (236) cvn H.B /DEST pdfmark endÂnew“½e“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (237) cvn H.B /DEST pdfmark endÂdelete“½in™ŸvÌÐocano“vÙ ersioniŽ¡‘:reciprocamente–€non“corrispondenti,“risultando“in“problemi“come“memory“leak“e“seÙ gmentation“fægault“(oŽ¡‘:in–€assolutamente“nessun“problema“in“certe“circostanze).“Lo“stesso“problema“pu€ò“všÙ ericarsi“se“diÀv˜erseŽ¡‘:všÙ ersioni–€delle“librerie“standard“v˜engono“usate“per“il“linking“del“modulo“e“dell'ese˜guibile.Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (238) cvn H.B /DEST pdfmark endŸÕÈ‘0ïcolor push BlackÆ€ˆï color popŽŽ‘:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (239) cvn H.B /DEST pdfmark end½Il–€destructor“della“classe“interfægaccia“deÀvÙ e“solitamente“essere“virtuale.“In“rari“casi“questo“pu€ò“non“essereŽ¡‘:necessario,–€ma“il“vÀantaggio“che“risulta“dalla“riduzione“dell'o•Ù v“erhead–€€è“cos€ì“ridotto“da“non“meritare“ilŽ¡‘:rischio.ŽŸ”ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (240) cvn H.B /DEST pdfmark endŸ æl‘:Se–€la“propria“interfægaccia“di“base“non“necessita“di“un“destructor™Ÿ,“se“ne“denisca“comunque“una“nonŽ¡‘:contenente–€istruzioni“(e“dichiararla“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (241) cvn H.B /DEST pdfmark endÂvirtual½),“altrimenti“prima“o“poi“si“aÌÐvranno“problemi,“possoŽ¡‘:gó7arantirvÙ elo.–€Ulteriori“informazioni“possono“essere“ottenute“nella“sezione“20“della“F‘ÿBA‘ÿs8Q“dellaŽ¡‘:neÀwsgroup–€comp.lang.c++“(ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (242) cvn H.B /DEST pdfmark endhttp://www‘ÿY .parashift.com/c++-fægaq-lite/).ŽŸ@Ÿïps:SDict begin H.S endïps:SDict begin 13 H.A endïJps:SDict begin [ /View [/XYZ H.V] /Dest (source) cvn H.B /DEST pdfmark endŽŸ0‘Hïcolor push Black’ÊÃ10ŽŽŽŽŽŽŽ’Ôï color popŽŽŒ‹ /ºñ‘·ºâŸ·ºâïþps:SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end ç ýU‘Hïcolor push Blackïcolor push gray 0ïps:SDict begin H.S endïcolor push gray 0ï color popŽïps:SDict begin H.R endïKps:SDict begin [ /View [/XYZ H.V] /Dest (page.11) cvn H.B /DEST pdfmark endï color popŸüfd’huìÃC++–€dlopen“mini“HO‘ÿÿWTÑðOŽŽŽŽŽŽŽ’Ôï color popŽŽ { ýœ›‘H¿4.‘ͽSor½°g,:entiïps:SDict begin H.S endïps:SDict begin 22.464 H.A endïIps:SDict begin [ /View [/XYZ H.V] /Dest (0.4.1) cvn H.B /DEST pdfmark endŽ‘HŸØ:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (245) cvn H.B /DEST pdfmark endŸ 'Æ‘0½TŒÏutto–€il“codice“sorÑðgente“contenuto“in“questo“documento“€è“disponibile“in“un“singolo“archiÀvio:Ž¤ ‘0ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (246) cvn H.B /DEST pdfmark endeÙ xamples.tar‘ÿs8.gz.ŽŸj8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (faq) cvn H.B /DEST pdfmark endŸ+BT¿5.‘ͽF‘þž"A‘ÿOQïps:SDict begin H.S endïps:SDict begin 22.464 H.A endïIps:SDict begin [ /View [/XYZ H.V] /Dest (0.5.1) cvn H.B /DEST pdfmark endŽŸåýïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (249) cvn H.B /DEST pdfmark endŸt¼ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (251) cvn H.B /DEST pdfmark endŸŽ¿‘0È1.–€½Sto“sviluppando“sotto“W™ŸindošÀws“e“non“riesco“a“troÙ v˜are“l'header“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (253) cvn H.B /DEST pdfmark endÂdlfcn.h½!“Qual'€è“il“problema?Ž©*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (254) cvn H.B /DEST pdfmark endŸÕÈ‘0Il–€problema“€è“che“l'header“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (256) cvn H.B /DEST pdfmark endÂdlfcn.h“½non“esiste“sotto“W™ŸindoÀws,“come“non“esiste“una“interfægaccia“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (257) cvn H.B /DEST pdfmark endÂdlopen½.Ž¡‘0Una–€API“con“funzionalit€à“similare“€è“centrata“sulla“funzione“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (258) cvn H.B /DEST pdfmark endÂLoadLibrary½,“e“la“maggior“parte“delleŽ¡‘0osservÀazioni–€contenute“in“questo“documento“€è“applicabile“a“questa“interfšægaccia.“Si“f˜accia“riferimento“alŽ¡‘0sito–€del“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (259) cvn H.B /DEST pdfmark endMicrosoft“DeÀvÙ eloper“Netwægork‘(http://msdn.microsoft.com/)“per“ulteriori“informazioni.Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (261) cvn H.B /DEST pdfmark endŸÕÈ‘0È2.–€½Esiste“un“wrapper“per“la“W™ŸindoÀws“API“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (263) cvn H.B /DEST pdfmark endÂLoadLibrary“½che“riproduca“l'interfægaccia“di“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (264) cvn H.B /DEST pdfmark endÂdlopen½?Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (265) cvn H.B /DEST pdfmark endŸÕÈ‘0Non–€sono“a“conoscenza“di“nessuna“API“del“genere,“ed“€è“probabile“che“un“wrapper“in“grado“di“supportareŽ¡‘0tutte–€le“opzioni“di“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (267) cvn H.B /DEST pdfmark endÂdlopen“½non“diÀvÙ err€à“mai“disponibile.Ž©*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (268) cvn H.B /DEST pdfmark endŸ ÕÈ‘0Esistono–€tuttaÌÐvia“delle“alternatišÀvÙ e:“libtltdl“(parte“di“libtool)“incapsula“una“v˜ariet€à“di“API“per“ilŽ¡‘0caricamento–€dinamico,“išÀvi“incluse“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (269) cvn H.B /DEST pdfmark endÂdlopen“½e“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (270) cvn H.B /DEST pdfmark endÂLoadLibrary½.“Un'altra“alternati˜v˜a“€è“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (271) cvn H.B /DEST pdfmark end“la“funzionalit€à“diŽ¡‘0caricamento–€dinamico“di“moduli“di“GlibŽ¡‘0(http://deÀvÙ eloper‘ÿs8.gnome.orÑðg/doc/API/glib/glib-dynamic-loading-of-modules.html).–€Si“pu€ò“utilizzare“unaŽ¡‘0di–€queste“API“per“gó7arantire“una“miglior“portabilit€à“tra“piattaforme.“Io“non“le“ho“mai“usate,“qundi“nonŽ¡‘0posso–€dire“quanto“stabili“o“funzionanti“queste“soluzioni“risultino“essere.Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (272) cvn H.B /DEST pdfmark endŸ ÕÈ‘0Si–€fægaccia“anche“riferimento“alla“sezione“4,“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (273) cvn H.B /DEST pdfmark endDynamically“Loaded“(DL)“Libraries,“della“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (274) cvn H.B /DEST pdfmark endProgram“LibraryŽ¡‘0HO¦gWTÑðO–€(http://www‘ÿY .dwheeler‘ÿs8.com/program-library)“per“altre“tecniche“per“caricare“librerie“e“istanziareŽ¡‘0classi–€indipendentemente“dalla“piattaforma.ŽŸ@Ÿ ïps:SDict begin H.S endïps:SDict begin 13 H.A endïKps:SDict begin [ /View [/XYZ H.V] /Dest (seealso) cvn H.B /DEST pdfmark endŸ-lŒ¿6.‘ͽAppr•§Œof“ondimentoïps:SDict begin H.S endïps:SDict begin 22.464 H.A endïIps:SDict begin [ /View [/XYZ H.V] /Dest (0.6.1) cvn H.B /DEST pdfmark endŽŸ“­ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (277) cvn H.B /DEST pdfmark endŸt¼ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (278) cvn H.B /DEST pdfmark endŸá‘0ïcolor push BlackÆ€ˆï color popŽŽ‘:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (279) cvn H.B /DEST pdfmark end½La–€pagina“man“per“la“funzione“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (280) cvn H.B /DEST pdfmark endÂdlopen(3)“½illustra“lo“scopo“e“l'uso“dell'API“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (281) cvn H.B /DEST pdfmark endÂdlopen½.Ž©*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (282) cvn H.B /DEST pdfmark endŸÕÈ‘0ïcolor push BlackÆ€ˆï color popŽŽ‘:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (283) cvn H.B /DEST pdfmark end½L‘ÿ'articolo–€ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (284) cvn H.B /DEST pdfmark end“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (285) cvn H.B /DEST pdfmark endÃDynamic“Class“Loading“for“C++“on“LinuxŽ¡‘:½(http://www‘ÿY .linuxjournal.com/article.php?sid=3687)–€di“James“Norton“pubblicato“sul“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (286) cvn H.B /DEST pdfmark endLinux“JournalŽ¡‘:(http://www‘ÿY .linuxjournal.com/).Ž¦ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (287) cvn H.B /DEST pdfmark endŸÕÈ‘0ïcolor push BlackÆ€ˆï color popŽŽ‘:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (288) cvn H.B /DEST pdfmark end½Il–€proprio“materiale“di“riferimento“preferito“sull'uso“di“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (289) cvn H.B /DEST pdfmark endÂextern‘ff"C"½,“ereditariet€à,“funzioni“virtuali,Ž¡‘:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (290) cvn H.B /DEST pdfmark endÂnew–€½e“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (291) cvn H.B /DEST pdfmark endÂdelete½.“L‘ÿ'autore“raccomanda“ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (292) cvn H.B /DEST pdfmark end[STR2000].Ž¤šÜïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (293) cvn H.B /DEST pdfmark endŸe$‘0ïcolor push BlackÆ€ˆï color popŽŽ‘:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (294) cvn H.B /DEST pdfmark endïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (295) cvn H.B /DEST pdfmark end½[ISO14882]Ž¡ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (296) cvn H.B /DEST pdfmark endŽŸ0‘Hïcolor push Black’ÊÃ11ŽŽŽŽŽŽŽ’Ôï color popŽŽŒ‹ /Îá‘·ºâŸ·ºâïþps:SDict begin /product where{pop product(Distiller)search{pop pop pop version(.)search{exch pop exch pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if end ç ýU‘Hïcolor push Blackïcolor push gray 0ïps:SDict begin H.S endïcolor push gray 0ï color popŽïps:SDict begin H.R endïKps:SDict begin [ /View [/XYZ H.V] /Dest (page.12) cvn H.B /DEST pdfmark endï color popŸüfd’huìÃC++–€dlopen“mini“HO‘ÿÿWTÑðOŽŽŽŽŽŽŽ’Ôï color popŽŽ { ýš‘xïcolor push BlackÆ€ˆï color popŽŽ’‚ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (297) cvn H.B /DEST pdfmark end½La–€ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (298) cvn H.B /DEST pdfmark endProgram“Library“HO¦gWTÑðO“(http://www‘ÿY .dwheeler‘ÿs8.com/program-library),“che“include“la“maggiorŽ¤ ’‚parte–€di“ci€ò“che“uno“sviluppatore“aÌÐvr€à“mai“bisogno“di“sapere“in“materia“di“librerie“statiche,“condiÀvise“eŽ¡’‚caricate–€dinamicamente“e“come“crearle.“Altamente“raccomandato.Ž–Hž”ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (299) cvn H.B /DEST pdfmark endŸæl‘0ïcolor push BlackÆ€ˆï color popŽŽ‘:ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (300) cvn H.B /DEST pdfmark end½La–€ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (301) cvn H.B /DEST pdfmark endLinux“GCC“HO¦gWTšÑðO“(http://tldp.or˜g/HO•¦gWT˜O/GCC-HO“WT˜O/indeÙ x.html)–€illustra“come“creareŽ¡‘:librerie–€con“GCC.ŽŸ”ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (302) cvn H.B /DEST pdfmark endŸk‹ÄBibÛ$liograaïps:SDict begin H.S endïps:SDict begin 18.72 H.A endïLps:SDict begin [ /View [/XYZ H.V] /Dest (0.6.11.2) cvn H.B /DEST pdfmark endŽŸ41ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (303) cvn H.B /DEST pdfmark endŸ ËÏ‘0½ISO14482–€ÃISO/IEC“14482-1998““The“C++“PrŒÏošæggrÙ amming“Langua˜g˜e½.“Disponibile“sia“in“PDF“cheŽ¡“rileÙ gó7ata–€in“un“libro“http://webstore.ansi.orÑðg/.ŽŸ*8ïps:SDict begin H.S endïps:SDict begin 13 H.A endïGps:SDict begin [ /View [/XYZ H.V] /Dest (308) cvn H.B /DEST pdfmark endŸ ÕÈ‘0STR2000–€Bjarne“Stroustrup“ÃThe“C++“PrŒÏošæggrÙ amming“Langua˜g˜e½,“Special“Edition.“ISBN“0-201-70073-5.Ž¡“Addison-W‘ÿ37esleÙ y.ŽŽŸ0‘Hïcolor push Black’ÊÃ12ŽŽŽŽŽŽŽ’Ôï color popŽŽŒøóRƒ’À;è¢T~Óºâ ó!áÚŽ phvro8tó ‰šš pcrr8tóáÚŽ phvr8tóª,« ptmb8tó‰š õà pcrb8tóXlï' ptmr8cóúff phvb8tóϯ8 ptmri8tó‰š pcrr8tóáÚŽ phvr8tóú phvb8tóúG® phvb8tóúâ phvb8tó?Á|‰ ptmr8tùýéßßßßßß