I'm learning how to detour-hook functions from tutorials online but when I follow along, my DLL says symbols not found.
The error I get says:
Linking dynamic library: bin\Debug\GLHook.dll
Cannot export GLHook_glAccum: symbol not defined
Cannot export GLHook_glAlphaFunc: symbol not defined
I don't know why though.. I've defined everything :S I'm trying to learn to use definition files while doing this as well.
I have:
MyDetour.h:
typedef void (WINAPI *ptr_glAccum) (GLenum op, GLfloat value);
typedef void (WINAPI *ptr_glAlphaFunc) (GLenum func, GLclampf ref);
extern ptr_glAccum optr_glAccum;
extern ptr_glAlphaFunc optr_glAlphaFunc;
MyDetour.cpp:
ptr_glAccum optr_glAccum;
ptr_glAlphaFunc optr_glAlphaFunc;
void GLHook_glAccum(GLenum op, GLfloat value)
{
(*optr_glAccum) (op, value);
}
void GLHook_glAlphaFunc(GLenum func, GLclampf ref)
{
(*optr_glAlphaFunc) (func, ref);
}
MyDetour.def:
LIBRARY GLHook
EXPORTS
glAccum = GLHook_glAccum @1
glAlphaFunc = GLHook_glAlphaFunc @2
Main.cpp:
#include "main.h"
#include "GLHook.hpp"
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
//........ LoadLibrary("OpenGL32.dll");
//........ optr_glAccum = GetProcAddress...
}
Main.h:
#ifndef __MAIN_H__
#define __MAIN_H__
#include <windows.h>
/* To use this exported function of dll, include this header
* in your project.
*/
#ifdef BUILD_DLL
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C"
{
#endif
//void DLL_EXPORT SomeFunction(const LPCSTR sometext);
#ifdef __cplusplus
}
#endif
#endif // __MAIN_H__
Any idea why it won't export?