Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Plugin comming on Go

linyows
April 24, 2017

Plugin comming on Go

fukuoka.go #8 - April 24, 2017 でのLTです

linyows

April 24, 2017
Tweet

More Decks by linyows

Other Decks in Programming

Transcript

  1. 1. p, _ := plugin.Open(“./plugins/animal.so”) // *PluginΛฦ͢ 2. symbol, _

    := p.Lookup(“Sounds”) // ΤΫεϙʔτ͞ΕͨV΍FΛγϯϘϧͱͯ͠ฦ͢ 3. sounds := symbol.(SoundsInterface) // IntefaceΛSymbolʹ౉͢͜ͱͰV΍F͕ར༻ՄೳͱͳΔ 4. sounds.Init(Sounds.conf) // ྫ͑͹ϝΠϯΞϓϦέʔγϣϯ͔Βͷઃఆ஋Λ౉͢ͳͲ 5. sounds.List[“dog”].MakeNoise() // ϝιουݺग़͠ 6. // => Bow wow! ϓϥάΠϯ࢖͍ํ GVLVPLBHP
  2. Versioning Most Of These Execution Modes Permit Code To Be

    Built At Different Times And Linked Together At Runtime. Nevertheless, We Require That All Go Code That Is Combined Into A Single Executable Image Must Be Built With The Same Version Of The Go Toolchain. We Require Further That If Any Go Package Appears More Than Once In The Executable Image, It Must Be Built From The Same Source Code. This Is A Very Strict Requirement. It Means That If A C Program Has A C Api Style Plugin Interface, And It Opens Multiple Plugins Written In Go, All Of Those Plugins Must Be Built With The Same Version Of The Go Toolchain, And Any Shared Packages Must Be Identical. It May Be Possible To Weaken This Restriction In The Future, But We’ll Start With This. Go Execution Modes (from Feature Proposals) GVLVPLBHP ͜ΕΒͷ࣮ߦϞʔυͷ΄ͱΜͲ͸ɺ࣮ߦ࣌ʹίʔυΛҟͳΔ࣌ؒʹߏஙͯ͠ϦϯΫ͢Δ͜ͱΛՄೳʹ͠·͢ɻ ͦΕʹ΋͔͔ΘΒͣɺ୯Ұ ͷ࣮ߦՄೳΠϝʔδʹ݁߹͞Εͨ͢΂ͯͷGoίʔυ͸ɺಉ͡όʔδϣϯͷGoπʔϧνΣʔϯͰߏங͢Δඞཁ͕͋Γ·͢ɻ ࣮ߦՄೳΠϝʔ δʹෳ਺ͷGoύοέʔδ͕ෳ਺දࣔ͞ΕΔ৔߹͸ɺಉ͡ιʔείʔυ͔Βߏங͢Δඞཁ͕͋Γ·͢ɻ ͜Ε͸ඇৗʹݫ͍͠ཁ݅Ͱ͢ɻ ͭ·ΓɺCϓϩάϥϜʹC APIελΠϧͷϓϥάΠϯΠϯλʔϑΣΠε͕͋ΓɺGoͰॻ͔Εͨෳ਺ͷϓϥά ΠϯΛ։͘ͱɺͦΕΒͷϓϥάΠϯ͸͢΂ͯGoπʔϧνΣʔϯͷಉ͡όʔδϣϯͰϏϧυ͞Εͳ͚Ε͹ͳΒͣɺڞ༗ύοέʔδ͸ಉҰͰ ͳ͚Ε͹ͳΓ·ͤΜɻ কདྷ͜ͷ੍ݶΛऑΊΔ͜ͱ͸Մೳ͔΋͠Ε·ͤΜ͕ɺ͜Ε͔Β࢝ΊΔͭ΋ΓͰ͢ɻ