# KHR\_debug & eglGetProcAddress()

**URL:** <https://forums.imgtec.com/t/khr-debug-eglgetprocaddress/2225>\
**Category:** PowerVR Insider\
**Tags:** pvrvframe\
**Created:** [December 31, 2014, 8:10pm UTC](https://forums.imgtec.com/t/khr-debug-eglgetprocaddress/2225 "2014-12-31T20:10:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dark\_photon](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/dark_photon/32/224_2.png) [@dark\_photon](https://forums.imgtec.com/u/dark_photon)\
**Post date:** [December 31, 2014, 8:10pm UTC](https://forums.imgtec.com/t/khr-debug-eglgetprocaddress/2225/1 "2014-12-31T20:10:21Z")

</div>

On PVRVFrame 3.3, KHR\_debug is advertised. However, eglGetProcAddress( “glDebugMessageCallbackKHR” ) fails (returns a NULL pointer). Same thing with eglGetProcAddress(“glDebugMessageCallback” ), even though that’s not the name for a KHR extension function.  
  
  
  
Digging into PVRVFrame 3.3’s libGLESv2.dll for clues, I find “\_glDebugMessageCallback@8” (i.e. “glDebugMessageCallback()”, with C naming and an explicit stdcall calling convention: i.e. \_\_declspec(dllexport) void \_\_stdcall)).  
  
  
  
So why can I not query this function with eglGetProcAddress() using PVRVFrame 3.3?  
  
  
  
  
  
As an aside, I note that in the PVRVFrame 3.4 libGLESv2.dll, the glDebugMessageCallback() is C++ name-mangled ("?glDebugMessageCallback@@YGXP6GXIIIIHPBDPBX@ZPAX@Z"). What’s going on there?

---

<div class="post-metadata">

**Author:** ![ChrisPenrose](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@ChrisPenrose](https://forums.imgtec.com/u/ChrisPenrose)\
**Post date:** [January 5, 2015, 10:39am UTC](https://forums.imgtec.com/t/khr-debug-eglgetprocaddress/2225/2 "2015-01-05T10:39:18Z")

</div>

Hi Dark\_Photon  
  
  
  
This is a bug caused by a disagreement between EGL and GLES with regards to the ‘KHR’ suffix.  
  
  
  
Unfortunately I don’t think we have a workaround for aquiring the function pointers but it will be fixed in the next release. We’ve also added visualizations to the GUI for debug groups and stuff and generally given KHR\_debug some overdue attention.

---

<div class="post-metadata">

**Author:** ![dark\_photon](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/dark_photon/32/224_2.png) [@dark\_photon](https://forums.imgtec.com/u/dark_photon)\
**Post date:** [January 5, 2015, 1:55pm UTC](https://forums.imgtec.com/t/khr-debug-eglgetprocaddress/2225/3 "2015-01-05T13:55:59Z")

</div>

Thanks, Chris. I appreciate you checking into it. If I get back to working with this, I might be able to bandaid around this by compile-time linking with the symbol directly and/or pulling in the symbol with explicit dlsym/LoadLibrary\*.

---

<div class="post-metadata">

**Author:** ![desperado](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@desperado](https://forums.imgtec.com/u/desperado)\
**Post date:** [August 4, 2020, 11:46am UTC](https://forums.imgtec.com/t/khr-debug-eglgetprocaddress/2225/4 "2020-08-04T11:46:25Z")

</div>

Greetings,

has this problem been solved and what is currently the correct way to retrieve the debug callback function pointers?

---

<div class="post-metadata">

**Author:** ![AlejandroC](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@AlejandroC](https://forums.imgtec.com/u/AlejandroC)\
**Post date:** [August 5, 2020, 11:18am UTC](https://forums.imgtec.com/t/khr-debug-eglgetprocaddress/2225/5 "2020-08-05T11:18:02Z")

</div>

Hi desperado,

The issue was tackled. You can use eglGetProcAddress to retrieve a function pointer to glDebugMessageCallbackKHR. The syntax should be something similar to:

PFNGLDEBUGMESSAGECALLBACKKHRPROC glDebugMessageCallbackKHR = (PFNGLDEBUGMESSAGECALLBACKKHRPROC) eglGetProcAddress( “glDebugMessageCallbackKHR” );

Regards,

Alejandro
