Skip to content

guesslin/plugin_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to build this example

  • run make all to generate all binary and plugins
  • run make clean to clean all binary and plugins

How to run this example

Usage

$ ./example -h
Usage of ./example:
  -mode string
        load which kind [adder|greet] of plugin (default "adder")
  -path string
        path to plugin file

Load Greeting

$ ./example -mode greet -path plugs/greeter/greeter.so
======= main =======
Greeting Mr. guesslin

Load different Adder

  • simple adder, implement a + b
$ ./example -mode adder -path plugs/adder/simple/simple.so
======= main =======
Adder 100 + 20 = 120 result
  • mod adder, implement (a + b) * 10 * alpha(0.5)
$ ./example -mode adder -path plugs/adder/mod/mod.so
======= main =======
Adder 100 + 20 = 600 result
  • average adder, implement (a + b) / 2
$ ./example -mode adder -path plugs/adder/average/average.so
======= main =======
Adder 100 + 20 = 60 result

About

example code for running Go Plugin

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published