Brandon
Brandon

Reputation: 23485

Hooking functions on Linux via .def file

On Windows in a .def file, I can hook functions like so:

glAccum                    =    Hook_glAccum;
glActiveTextureARB         =    Hook_glActiveTextureARB;
glAlphaFunc                =    Hook_glAlphaFunc;
glAreTexturesResident      =    Hook_glAreTexturesResident;
glArrayElement             =    Hook_glArrayElement;

This way, all calls to glAccum are redirected to Hook_glAccum. All calls to glArrayElement are redirected to Hook_glArrayElement and so on..

I am not able to find the linux equivalent of a .def file or the equivalent of doing the above. Any ideas how I can achieve the same thing?

Upvotes: 1

Views: 448

Answers (1)

voodooattack
voodooattack

Reputation: 1176

You can achieve the same result at run-time with LD_PRELOAD and weak symbols. Here are a few tutorials to demonstrate:

Understand Weak Symbols by Examples

Simple LD_PRELOAD Tutorial

Upvotes: 1

Related Questions