getNamedResource cpp prototype

I’m not sure how new this is but I’ve just noticed that BinaryData::getNamedResource now only appears in BinaryData.cpp. Shouldn’t the function prototype be in the header file? It looks like this at the moment:

const char* getNamedResource (const char*, int&) throw(); const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw() { ... }

Yeah, that’s deliberate. There was some kind of stupid compiler warning that was triggered unless the function had a prototype, and since BinaryData.cpp doesn’t actually include BinaryData.h, I just duplicated it in there.

I just wanted to add that maybe a macro for fetching images would be nice, i use that a lot

#define img(x)												ImageCache::getFromMemory(x, x ## Size)

Nice idea. (It’s good practice to always make your macros upper-case though!)

Ok that makes sense but its only present in the cpp file, the header needs the prototype as well other wise its not visible to the rest of the project.

I’m confused… AFAICT it’s in the header as well, right?

Not for me at least. Pulled the tip this morning (“AU plugin hosting: now…”), generate new Introjucer project, add an ogg file to it, this is the full contents of the header:

[code]/* =========================================================================================

This is an auto-generated file, created by The Introjucer 3.0.0
Do not edit anything in this file!

*/

namespace BinaryData
{
extern const char* Whitenoisesound_ogg;
const int Whitenoisesound_oggSize = 660867;

}[/code]

Oh, I see… I’ve mistakenly made it omit that if there aren’t any images in your resources. All my projects do contain images so I hadn’t noticed. I’ll sort that out now…

Sorted, thanks.