Is there any standard way of embedding resources into Linux executable image? [duplicate]

Make yourself an assembler file, blob.S: .global blob .global blob_size .section .rodata blob: .incbin “blob.bin” 1: blob_size: .int 1b – blob Compile with gcc -c blob.S -o blob.o The blob can now be accessed from within your C program with: extern uint8_t blob[]; extern int blob_size; Using a bin2c converter usually works fine, but if … Read more

Can I link a plain file into my executable? [duplicate]

You could do this: objcopy –input binary \ –output elf32-i386 \ –binary-architecture i386 my_file.xml myfile.o This produces an object file that you can link into your executable. This file will contain these symbols that you’ll have to declare in your C code to be able to use them 00000550 D _binary_my_file_xml_end 00000550 A _binary_my_file_xml_size 00000000 … Read more

GetManifestResourceStream returns NULL

You can check that the resources are correctly embedded by using //From the assembly where this code lives! this.GetType().Assembly.GetManifestResourceNames() //or from the entry point to the application – there is a difference! Assembly.GetExecutingAssembly().GetManifestResourceNames() when debugging. This will list all the (fully qualified) names of all resources embedded in the assembly your code is written in. … Read more

How to create an email with embedded images that is compatible with the most mail clients

I’ve had success with exactly the same headers as you’re using, with the following differences: Embedded is not a valid value for the Content-Disposition header. attachment should be fine. inline should also be fine, though I’ve usually seen attachment for multipart/related embedded images. The value of the Content-ID header is supposed to be in the … Read more

Embed resources (eg, shader code; images) into executable/library with CMake

As an alternative to the answer of sfstewman, here’s a small cmake (2.8) function to convert all files in a specific folder to C data and write them in wished output file: # Creates C resources file from files in given directory function(create_resources dir output) # Create empty output file file(WRITE ${output} “”) # Collect … Read more

Could not find any resources appropriate for the specified culture or the neutral culture

I just hit this same exception in a WPF project. The issue occurred within an assembly that we recently moved to another namespace (ProblemAssembly.Support to ProblemAssembly.Controls). The exception was happening when trying to access resources from a second resource file that exists in the assembly. Turns out the additional resource file did not properly move … Read more

Background image for a jPanel not working

A simple method, if you’re not interested in resizing the background image or applying any effects is to use a JLabel… BufferedImage bg = ImageIO.read(Menu.class.getResource(“/imgs/rotom.jpg”)); JLabel label = new JLabel(new ImageIcon(bg)); setContentPane(label); setLayout(…); There are limitations to this approach (beyond scaling), in that the preferred size of the label will always be that of the … Read more

Strange behavior of Class.getResource() and ClassLoader.getResource() in executable jar

I thought this question was already asked and answered! What is the difference between Class.getResource() and ClassLoader.getResource()? getClass().getResource() searches relative to the .class file while getClass().getClassLoader().getResource() searches relative to the classpath root. If there’s an SSCCE here, I don’t understand why it doesn’t 1) Show the directory organization in the .jar, and… 2) Take package … Read more