开发者

Linux - Is there a way to have a simple static library that contains resources? [duplicate]

This ques开发者_如何学Pythontion already has answers here: Closed 11 years ago.

Possible Duplicate:

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

I am trying to figure out a way of embedding a resource into a static library for linking with C source using the gcc toolchain. The equivalent of a Windows DLL in which resources are embedded. Can this be done with a linux static library?

In short, would for example, doing this cat someresourcedata.txt > mylib.a and to be able to link it with a compiled C code that references mylib.a.

Any ideas or suggestions?


If the data can be represented as text, place it into an include file. Here's an example for how to do this with an XPM image:

/* XPM */
static char * my_xpm_image[] = {
"16 16 15 1",
"       c None",
".      c #000000",
"+      c #7FFFFF",
"@      c #007F7F",
....

And then go about the standard way of creating a static lib (whatever that is - I've not done it, only a dynamic lib and I'm a little rusty on that).


*nix does not have the same concept of "resources" that Windows does; they are usually stored as external files, both for executables and libraries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜