12

So I have a Visual Studio 2008 project which has a large amount of binary data that it is currently referencing. I would like to package the binary data much like you can do with C# by adding it as a "resource" and compiling it as a DLL.

Lets say all my data has an extension of ".data" and is currently being read from the visual studio project.

Is there a way that you can compile or link the data into the .dll which it is calling?

I've looked at some of the google link for this and so far I haven't come up with anything - the only possible solution I've come up with is to use something like ResGen to create a .resources file and then link it using AssemblyLinker with /Embed or /Link flags. I dont think it'd work properly though because I dont have text files to create the .resources files, but rather binary files themselves.

Any advice?

2 Answers 2

7
  1. Right click the resource script (.rc file)
  2. Choose Import

http://msdn.microsoft.com/en-us/library/saced6x2.aspx

You can embed any "custom" file you want, as well as things like .bmps and stuff VisualStudio "knows" how to edit. Then you can access them with your framework's resource functions like FindResource LoadResource etc...

If you don't have a resource script.

  1. Click Project
  2. Add New Item
  3. Resource Script

http://msdn.microsoft.com/en-us/library/sxdy04be(v=VS.71).aspx

Sign up to request clarification or add additional context in comments.

3 Comments

How do you import binary data with this? It appears easy to do with "bitmap (.bmp), icon (.ico), cursor (.cur), Html file (.htm)" but how does one do it with importing "other" data?
What if there is no resource script?
@CrimsonX When you import a file that Visual Studio doesn't understand or edit, it can still shove it into the PE file's data (executable or dll) even though it can't read it. "Resoucres" are just files in the data section of your exe or dll. msdn.microsoft.com/en-us/magazine/cc301805.aspx
7

You can embed the binary data as a C language array - no resources involved at all. An old classic trick. see for example XD

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.