问题
Is there a way to add files or other binary data to a DLL so that the program can access it during runtime by "loading" with a filename?
I am programming a DLL which has some code fragments like:
SomeObject mObject = SomeObject("filename.xml");
Now I have 2 problems:
- I don't know where the .xml file is placed during runtime since I don't know where the DLL is used.
- I don't even want to give the .xml file to the user of the DLL.
where SomeObject
is from an external library so I can't change the way those objects are created. Some kind of data is needed that can be accessed like a file called "filename.xml".
So how can I "include" the xml file in that DLL?
I'm using Visual Studio 2010 and Visual C++ compiler. I've read some things about "resources" but it looks like I can't acess them like external files (needed for my constructor call) and instead they are kind of imported directly? Maybe I'm wrong there though...
来源:https://stackoverflow.com/questions/25870213/c-adding-external-xml-file-to-a-dll-project-to-load-access-it-during-executio