#include #include #include #include #include #include "ITest.h" typedef int (*func)(int, int); typedef ITest* (*_create)(void); int main(int argc, char** argv) { for(int i = 1; i < argc; i++) { try { std::cout << "loading " << argv[i] << std::endl; cross::DynamicLibrary* pDynLib = new cross::DynamicLibrary( argv[i] ); func bar = (func)pDynLib->GetFunction("foo"); std::cout << bar(5, 2) << std::endl; _create cre = (_create)pDynLib->GetFunction("create"); ITest* p_test = cre(); std::cout << p_test->foobar() << std::endl; delete p_test; std::cout << "unloaded " << argv[i] << std::endl; delete pDynLib; } catch(std::exception ex) { std::cout << "exception " << ex.what() << std::endl; exit(EXIT_FAILURE); } } return 0; }