OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
BasicPluginLoader.cpp
Go to the documentation of this file.
1 
12 // Copyright 2014 Sensics, Inc.
13 //
14 // Licensed under the Apache License, Version 2.0 (the "License");
15 // you may not use this file except in compliance with the License.
16 // You may obtain a copy of the License at
17 //
18 // http://www.apache.org/licenses/LICENSE-2.0
19 //
20 // Unless required by applicable law or agreed to in writing, software
21 // distributed under the License is distributed on an "AS IS" BASIS,
22 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 // See the License for the specific language governing permissions and
24 // limitations under the License.
25 
26 // Internal Includes
28 
29 // Library/third-party includes
30 // - none
31 
32 // Standard includes
33 #include <iostream>
34 #include <exception>
35 
36 int main(int argc, char *argv[]) {
37  if (argc < 2) {
38  std::cerr << "Must supply a plugin name to load." << std::endl;
39  return 1;
40  }
42 
43  try {
44  std::cout << "Trying to load plugin " << argv[1] << std::endl;
45  ctx.loadPlugin(argv[1]);
46  std::cout << "Successfully loaded plugin, control returned to host "
47  "application!" << std::endl;
48  return 0;
49  } catch (std::exception &e) {
50  std::cerr << "Caught exception tring to load " << argv[1] << ": "
51  << e.what() << std::endl;
52  return 1;
53  }
54  std::cerr << "Failed in a weird way - not a std::exception." << std::endl;
55  return 2;
56 }
Class responsible for hosting plugins, along with their registration and destruction.