0ad/source/lib/sysdep/os/linux/linux.cpp
janwas c4654fd8fa bits: avoid sign conversion warning
debug: cleanup
ogl_tex, tex: use full-width types to avoid truncation warnings
wdbg_sym.cpp: skip __suppress and __profile symbols; add additional hex
display for floats; cleanup
wdll_ver.cpp: cppdoc+cleanup (remove non-reentrant C interface, replace
with std::string)
sysdep: add cppdoc

everything else: flag parameters are now consistently size_t instead of
int (avoids warnings, allows slightly better code on x64)

This was SVN commit r6392.
2008-09-18 11:27:55 +00:00

22 lines
402 B
C++

#include "precompiled.h"
#include "lib/sysdep/sysdep.h"
#define GNU_SOURCE
#include <dlfcn.h>
LibError sys_get_executable_name(char* n_path, size_t max_chars)
{
Dl_info dl_info;
memset(&dl_info, 0, sizeof(dl_info));
if (!dladdr((void *)sys_get_executable_name, &dl_info) ||
!dl_info.dli_fname )
{
return ERR::NO_SYS;
}
strncpy(n_path, dl_info.dli_fname, max_chars);
return INFO::OK;
}