I needed to embed a resource (icon) to a static library so we can deploy just the .lib and .h files with no need to include any graphics or .rc files.
I wanted my static library to be used by any application including such that don’t have any graphic user interface, i.e. Console applications, etc.
Here is the question I have posted:
Is there a way to embed resources (such as icons, dialogs) in a c++ (Win32 API) static library? My purpose is to embed an icon in the static library in a way that functions that use LoadIcon will work as if it was a normal .exe so the main application can only link to the static library and include a header file, with no requirement to add other files such as .rc files, or .ico files, etc. Clearly the main application who uses the static library doesn’t have this resource so LoadIcon will fail, however I was wondering if there is a workaround to make it work. A static array with the icon data can work as long as the standard API calls (such as LoadIcon) will work.
To explain further, the person who will be using the static library will only have 2 files: .lib and .h and will not have any .rc file
Comments that followed:
“It is not possible, you can stop looking. Consider a DLL project instead.“
At Code Project I was pointed to the following Stack Overflow thread: