What is the equivalent of LoadString function in Linux?

Viewed 169

LoadString function defined in windows can be used to load strings from a resource like dll or exe.

What is the LoadString equivalent function in Linux?

1 Answers

As noted in the comments, there is no single Linux operating system support for extracting resources from executables. There are multiple option in Linux for Internationalization (i18n), Localization (l10n) which may address your requirements.

Depending on your goals (externalization of messages, support for i18n, ...), similar functionality exists in different programming languages:

  1. Java has resources (which can be added into JAR files),
  2. LIBC provides gettext (via external message file ".po" files). See https://en.wikipedia.org/wiki/Gettext
  3. Many scripting environment (python, perl) provide interfaces to gettext via modules.
  4. Most GUI based frameworks have support for external resources (Gnome, Xt/X11, ...)

As a side note, it is possible to implement "LoadString", assuming messages are complied into the executable (as "C" code, or similar), using the dlsym dynamic lookup. Probably a last resort option.

Related