get_new_interface.cpp

This example shows how to get access to the exporting interface.

#include        <loaders/dynamic_lib_loader.h>
#include        <utilities/plugin_interface.h>

class           Derived1{};

int main( int argc , char * argv[] )
{
        nitro::DynamicLibLoader         Plugin( "./plugin.dll" );

        // here Ptr1 and Ptr2 are the same pointers
        Derived1 *                      Ptr1( nitro::PluginInterface::GetInterface< Derived1 >( Plugin ) );
        Derived1 *                      Ptr2( nitro::PluginInterface::GetInterface< Derived1 >( Plugin ) );

        // here Ptr3 and Ptr4 points on absolutely different memory blocks
        Derived1 *                      Ptr3( nitro::PluginInterface::GetNewInterface< Derived1 >( Plugin ) );
        Derived1 *                      Ptr4( nitro::PluginInterface::GetNewInterface< Derived1 >( Plugin ) );

        return 0;
}

Generated by  doxygen 1.6.1