Skip to content

Commit

Permalink
Add shared types between host / plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
7sharp9 committed Oct 28, 2021
1 parent 95399dd commit c355dc3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Myriad/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ open McMaster.NETCore.Plugins
module Implementation =
let findPlugins (path: string) =

let loader = PluginLoader.CreateFromAssemblyFile(path)
let assembly = loader.LoadDefaultAssembly();
let loader = PluginLoader.CreateFromAssemblyFile(path, sharedTypes = [|typeof<MyriadGeneratorAttribute>; typeof<IMyriadGenerator> |])
let assembly = loader.LoadDefaultAssembly()
let types = assembly.GetTypes()
let gens =
[ for t in assembly.GetTypes() do
[ for t in types do
if t.GetCustomAttributes(typeof<MyriadGeneratorAttribute>, true).Length > 0
then yield t ]
gens
Expand Down

0 comments on commit c355dc3

Please sign in to comment.