dll resources?

Hi guys so from what I read and I will quote an answer from stackoverflow


A DLL contains functions, classes, variables, UIs and resources (such as icons, images, files, ...) that an EXE, or other DLL uses.


how would a dll file possibly contain resources such as icons,images or files?

could someone give me an example of how this would be done or link to some code on how its done?

thanks
closed account (E0p9LyTq)
@adam2016,

can you create a Windows GUI app with icons and images as resources?

A DLL is no different than an executable when it comes to embedded resources.
closed account (E0p9LyTq)
Creating a Custom Resource file:
https://technet.microsoft.com/en-us/library/hh855058.aspx
how would a dll file possibly contain resources such as icons,images or files?


This is a feature built into the exe and dll file formats. There are special sections devoted to resources and as others pointed out to you there are tools that are part of the MSVC compiler that allow you to compile resource files as part of the build process. This tool takes your resource definition .rc files and compiles them to .res files, which is roughly the equivalent of taking a .cpp file and compiling it to a .obj file. The linker can then take the .res files as input along with the .obj files and will link them in the appropriate section in the exe or dll.

As a side note, I actually do something similar on GCC. You can use the objcopy program to compile any file to a .o object file and link it with your program. GCC doesn't mind that it's not code, it will happily link data as well. The only thing you need to do to access this data is define a header file with an unsigned char* to that data with the same symbol name. This might be kind of a hacky thing to do, I'm just mentioning it because this feature is not unique to Microsoft compilers.
Topic archived. No new replies allowed.