I'm messing around with boost function and I came up with the following code. This isn't much different than using a typedef to declare a function pointer so I'm probably doing something wrong. boost::function is supposed to make things cleaner, right?
Will someone show me the proper way to use boost::function?
Code:
boost::function< int (const char *) > impPyRun_SimpleString;
boost::function< int () > impPy_Initialize;
boost::function< int () > impPy_IsInitialized;
boost::function< PyGILState_STATE () > impPyGILState_Ensure;
boost::function< void (PyGILState_STATE) > impPyGILState_Release;
void InitFunctionPointers()
{
impPyRun_SimpleString = (int (*)(const char *))GetProcAddress(GetModuleHandleA("python25"), "PyRun_SimpleString");
impPy_Initialize = GetProcAddress(GetModuleHandleA("python25"), "Py_Initialize");
impPy_IsInitialized = GetProcAddress(GetModuleHandleA("python25"), "Py_IsInitialized");
impPyGILState_Ensure = (PyGILState_STATE (*)())GetProcAddress(GetModuleHandleA("python25"), "PyGILState_Ensure");
impPyGILState_Release = (void (*)(PyGILState_STATE))GetProcAddress(GetModuleHandleA("python25"), "PyGILState_Release");
}