Skip to content

Instantly share code, notes, and snippets.

@altexy
Last active December 12, 2015 09:39
Show Gist options
  • Save altexy/4753458 to your computer and use it in GitHub Desktop.
Save altexy/4753458 to your computer and use it in GitHub Desktop.
#include <lua.h>
#include <lauxlib.h>
#define __USE_GNU
#include <dlfcn.h>
LUALIB_API int luaopen_my_module_core (lua_State *L)
{
/* TODO - Windows version, DllMain, then GetModuleFileName */
Dl_info dl_info;
dladdr((void *)luaopen_my_module_core, &dl_info);
lua_pushstring(L, dl_info.dli_fname);
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment