All pastes #105759 Raw Edit

Cody Brocious

public c v1 · immutable
#105759 ·published 2006-07-29 22:09 UTC
rendered paste body
#include <dlfcn.h>#include <Nucleus/Nucleus.h>#define NUMODULE_NAME "Linkwrapper"void **imports[] = {	{"User32.dll", "MessageBoxA", 0xDEADBEEF},	{NULL, NULL, NULL}};int main() {	void *nucore;	void (*NuCore_Setup)();	void (*NuCore_Import)(char *module_name, char *function_name);	void (*NuCore_GetError)();		void (*WinCore_Setup)(void **[]imports);		NuLog("Opening NuCore");		nucore = dlopen("../LibAlky/Build/libNuCore.dylib", RTLD_NOW|RTLD_GLOBAL);		if(nucore == None)		NuError("NuCore could not be loaded: %s", dlerror());		NuCore_Setup = dlsym(nucore, "NuCore_Setup");	if(NuCore_Setup == None)		NuError("NuCore_Setup could not be resolved: %s", dlerror());			NuCore_Import = dlsym(nucore, "NuCore_Import");	if(NuCore_Import == None)		NuError("NuCore_Import could not be resolved: %s", dlerror());		NuCore_GetError = dlsym(nucore, "NuCore_GetError");	if(NuCore_GetError == None)		NuError("NuCore_GetError could not be resolved: %s", dlerror());		NuCore_Setup();		WinCore_Setup = NuCore_Import("WinCore", "WinCore_Setup");	if(WinCore_Setup == None)		NuError("WinCore_Setup could not be resolved: %s", NuCore_Error());		WinCore_Setup(imports);}