static GLboolean stubGetPatchOffset(const char *name, void **writePtr, const void **execPtr) { const struct mapi_stub *stub; void *addr = NULL; stub = stub_find_public(name); #if !defined(STATIC_DISPATCH_ONLY) if (!stub) { stub = stub_find_dynamic(name, 0); } #endif // !defined(STATIC_DISPATCH_ONLY) if (stub) { addr = stub_get_addr(stub); } if (writePtr != NULL) { *writePtr = addr; } if (execPtr != NULL) { *execPtr = addr; } return (addr != NULL ? GL_TRUE : GL_FALSE); }
static GLboolean stubGetPatchOffset(const char *name, void **writePtr, const void **execPtr) { const struct mapi_stub *stub; void *writeAddr = NULL; const void *execAddr = NULL; stub = stub_find_public(name); #if !defined(STATIC_DISPATCH_ONLY) if (!stub) { stub = stub_find_dynamic(name, 0); } #endif // !defined(STATIC_DISPATCH_ONLY) if (stub) { mapi_func addr = stub_get_addr(stub); if (addr != NULL) { entry_get_patch_addresses(addr, &writeAddr, &execAddr); } } if (writePtr != NULL) { *writePtr = writeAddr; } if (execPtr != NULL) { *execPtr = execAddr; } return ((writeAddr != NULL && execAddr != NULL) ? GL_TRUE : GL_FALSE); }
/** * Return the address of an entry. Optionally generate the entry if it does * not exist. */ mapi_proc mapi_get_proc_address(const char *name) { const struct mapi_stub *stub; stub = stub_find_public(name); if (!stub) stub = stub_find_dynamic(name, 0); return (stub) ? (mapi_proc) stub_get_addr(stub) : NULL; }
static void stubRestoreFuncs(void) { int i, slot; const struct mapi_stub *stub; assert(stub_allow_override()); for (stub = public_stubs, i = 0; i < MAPI_TABLE_NUM_STATIC; stub++, i++) { slot = (stub->slot == -1) ? MAPI_LAST_SLOT : stub->slot; entry_generate_default_code((char *)stub_get_addr(stub), slot); } #if !defined(STATIC_DISPATCH_ONLY) for (stub = dynamic_stubs, i = 0; i < num_dynamic_stubs; stub++, i++) { slot = (stub->slot == -1) ? MAPI_LAST_SLOT : stub->slot; entry_generate_default_code((char *)stub_get_addr(stub), slot); } #endif // !defined(STATIC_DISPATCH_ONLY) }
/** * Return pointer to the named function. If the function name isn't found * in the name of static functions, try generating a new API entrypoint on * the fly with assembly language. */ _glapi_proc _glapi_get_proc_address(const char *funcName) { const struct mapi_stub *stub = _glapi_get_stub(funcName, 1); return (stub) ? (_glapi_proc) stub_get_addr(stub) : NULL; }