我有一个函数指针指向一个动态库,获取一个函数指针到C(C89)动态库
#include <GL/gl.h> /* or something */
void (*vertex)(float, float) = &glVertex2f;
在GCCi686,苹果darwin10-GCC-4.2.1它一直工作,但在Visual Studio 2010上失败,
error 'vertex': address of dllimport 'glVertex2f' is not static
我把它配置为C89;我相信这是唯一可用的C.这个想法是我想在其他不包含库头文件的文件中调用函数指针extern
。
这看起来很有希望,但我不包括Windows.h,如果我可以避免它。 –