glh_glut_callfunc.h
Go to the documentation of this file.
00001 /*
00002 glh - is a platform-indepenedent C++ OpenGL helper library 
00003 
00004   
00005     Copyright (c) 2000 Cass Everitt
00006         Copyright (c) 2000 NVIDIA Corporation
00007     All rights reserved.
00008         
00009     Redistribution and use in source and binary forms, with or
00010     without modification, are permitted provided that the following
00011     conditions are met:
00012           
00013         * Redistributions of source code must retain the above
00014           copyright notice, this list of conditions and the following
00015           disclaimer.
00016                 
00017     * Redistributions in binary form must reproduce the above
00018           copyright notice, this list of conditions and the following
00019           disclaimer in the documentation and/or other materials
00020           provided with the distribution.
00021                   
00022         * The names of contributors to this software may not be used
00023           to endorse or promote products derived from this software
00024           without specific prior written permission. 
00025                         
00026         THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00027         ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00028         LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00029         FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00030         REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00031         INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00032         BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00033         LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00034         CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00035         LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00036         ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
00037         POSSIBILITY OF SUCH DAMAGE. 
00038                           
00039                                 
00040         Cass Everitt - cass@r3.nu
00041 */
00042 
00043 #ifndef GLH_GLUT_CALLFUNC_H
00044 #define GLH_GLUT_CALLFUNC_H
00045 
00046 #include <string>
00047 
00048 #ifdef _WIN32
00049 #define GLH_FUNC extern "C" __declspec(dllexport) 
00050 #else
00051 #define GLH_FUNC
00052 #endif
00053 
00054 
00055 namespace glh
00056 {
00057 
00058         struct library_handle
00059         {
00060 #ifdef _WIN32
00061                 bool init(const char * name)
00062                 {
00063                         lib = GetModuleHandle(name);
00064                         if(lib) return true;
00065                         std::string n(name);
00066                         n += ".exe";
00067                         lib = GetModuleHandle(n.c_str());
00068 
00069                         return lib != 0;
00070                 }
00071                 void call_func(const char k, int x, int y)
00072                 {
00073                         std::string entry_name("key__");
00074                         entry_name += k;
00075                         void (*entry)(int, int) = (void (*)(int, int))GetProcAddress(lib, entry_name.c_str());
00076                         if(entry)
00077                                 (*entry)(x, y);
00078                 }
00079                 HMODULE lib;
00080 #endif
00081         };
00082         
00083 }
00084 
00085 #endif


nao_openni
Author(s): Bener SUAY
autogenerated on Mon Jan 6 2014 11:27:50