Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Linux equivalent of Windows' "resource files"?

I have a C library, which I build as a shared object for Linux and a DLL for Windows with MinGW32. The API depends on a couple of data files (statistical models) which I'd really like to roll in with the SO/DLL so that deployment is just one file.

It looks like I can achieve this for Windows with a "resource file" compiled with windres, but then I've got to write a bunch of resource-handling code for Windows, and I'm still stuck with the files on Linux.

Is there a way to achieve the same functionality on Linux?

Even better, is there a portable solution?

like image 450
cibyr Avatar asked Jan 04 '10 02:01

cibyr


People also ask

What is a Windows resource file?

A resource file is a text file with the extension . rc. The file can use single-byte, double-byte, or Unicode characters. The syntax and semantics for the RC preprocessor are similar to those of the Microsoft C/C++ compiler.

What are Visual Studio resource files?

Visual Studio provides a resource editor that lets you add, delete, and modify resources. At compile time, the resource file is automatically converted to a binary . resources file and embedded in an application assembly or satellite assembly. For more information, see the Resource files in Visual Studio section.


1 Answers

It's actually quite simple on Linux and other ELF systems: http://www.linuxjournal.com/content/embedding-file-executable-aka-hello-world-version-5967

OS X has bundles, so you just build your library as a framework and put the file in the bundle.

like image 63
Andrew McGregor Avatar answered Oct 05 '22 20:10

Andrew McGregor