LLVM API Documentation

PluginLoader.h
Go to the documentation of this file.
00001 //===-- llvm/Support/PluginLoader.h - Plugin Loader for Tools ---*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // A tool can #include this file to get a -load option that allows the user to
00011 // load arbitrary shared objects into the tool's address space.  Note that this
00012 // header can only be included by a program ONCE, so it should never to used by
00013 // library authors.
00014 //
00015 //===----------------------------------------------------------------------===//
00016 
00017 #ifndef LLVM_SUPPORT_PLUGINLOADER_H
00018 #define LLVM_SUPPORT_PLUGINLOADER_H
00019 
00020 #include "llvm/Support/CommandLine.h"
00021 
00022 namespace llvm {
00023   struct PluginLoader {
00024     void operator=(const std::string &Filename);
00025     static unsigned getNumPlugins();
00026     static std::string& getPlugin(unsigned num);
00027   };
00028 
00029 #ifndef DONT_GET_PLUGIN_LOADER_OPTION
00030   // This causes operator= above to be invoked for every -load option.
00031   static cl::opt<PluginLoader, false, cl::parser<std::string> >
00032     LoadOpt("load", cl::ZeroOrMore, cl::value_desc("pluginfilename"),
00033             cl::desc("Load the specified plugin"));
00034 #endif
00035 }
00036 
00037 #endif