This project is read-only.
Project Description
NEF (Native Extensibility Framework) is an open source IoC extensibility framework targetting C++. It is modeled after the more useful features of MEF in C#.

NOTE: This project is still under construction. Documentation is lacking but is coming soon.

This project provides the following features:

Automatic Export Resolution

All types conforming to the global nef_export contract will automatically be detected and loaded. No registration function required. This also works when libraries are loaded at runtime.

Load Libraries At Runtime

NEF allows you to load assemblies at runtime by either giving it a path or a directory to load from. The latter loads all assemblies in the specified directory and sub-directories. NEF will detect all exports in the assembly when it is loaded

Automatic Import Detection/Resolution

You can get imports the following ways
  • Simply set the member variable
  • Call a setter function

Import Many

Similar to regular import, NEF allows you to get all related exports and store it in a vector.


Like it's C# counterpart, NEF allows you to implement the OnImportsSatisfied function which gets called once all imports have been filled.

Dependency Chaining

Like all IoC containers, NEF will build out a dependency graph for your type and resolve depth first, so that by the time your type gets its imports, they have all been satisfied as well

Object Lifetime Control

NEF provides the following object lifetime mechanisms out of the box:
  • Shared - The same instance is used to satisfy all exports
  • Non Shared - Each import gets its own instance
  • Shared Volatile - The same instance is used for all imports, for as long as that instance is being used. Once no importees are using the object, its memory will be reclaimed, and a new one will be issued for subsequent requests. This is useful for system resource sharing when you don't want to keep the resource for the lifetime of the program.
  • Ad-Hoc - You can get an export factory, which allows the user to define when new instances are created (When combined with a non-shared export)

In this regard, NEF is extensible so new instance policies can easily be created.


Like MEF, you can configure contracts by type, and optionally also include a name.

Best of All

In NEF, there is absolutely NO code generation that is performed by 3rd party tools. NEF uses some preprocessor trickery and exotic template programming to introspect types without relying on config files and code generators.

This library also tends to perform better than MEF since all of the introspection is actually performed at compile time, so during runtime, NEF already knows exactly what to do with each type being composed.


NEF is MIT licensed. Do with it what you will.

Last edited Dec 24, 2014 at 5:38 PM by MikeRanzinger, version 12