How do I create a resource dll ? The dll will be having a set of .png files. In a way these .png files should be exposed from the dll. My application would need to refer this dll to get a .png file.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A resource dll is the same as any other dll, it just has little or no code in it, and relatively more resources.
Microsoft doesn’t have a predefined resource type for PNG files, but you can define your own
The most minimal possible resource dll is just a compiled .rc file passed to the linker like this.
Then execute these commands at a command prompt.
Thats it. the first command compiles resources.rc into resources.res
the second command turns resources.res into a dll.
You should now have a dll called
resources.dllthat contains a single png file.In practice, of course, you will want to put the
#definesin a header file that you share with the code that uses the dll.To use the dll in C++, your code would look something like this.