Home » Community » Newbie corner » One way to share IML across obj files
One way to share IML across obj files [message #24986] |
Sat, 06 February 2010 21:58  |
alendar
Messages: 47 Registered: January 2010 Location: Idaho, USA
|
Member |
|
|
At the end of page it mentions the basics of how to use an IML file (a collection of images) in more than one cpp file. But no example.
So here's how I got it to work:
1) Create your iml file (I called it "project.iml").
2) Create a file (I called it "image_shared.h") with the following:
#define IMAGECLASS MyImages
#define IMAGEFILE "project.iml"
Do NOT source guard these with #ifdefs. the iml handler files #undefs your defs.
3) Make a project shared header file that's in all your cpps. (I called mine project_shared.h). Put this:
#include "image_shared.h"
#include <Draw/iml_header.h>
4) Make a project shared source file (i.e., project_shared.cpp) with this:
#include "project_shared.h"
#include "image_shared.h"
#include <Draw/iml_source.h>
You don't have to use any images in this file, but it has to be here or in another cpp. It must be in one and only one cpp.
5) In the other cpps that want to show images, put:
#include "project_shared.h"
Now your images will work anywhere:
playing = MyImages::play();
There's probably a better way to do it, but the key is to not source guard the defines and only have iml_source declared once in on cpp file.
Since it took my so long to figure it out (1000 monkeys writing Shakespeare technique), I thought it might help someone else.
cd7651feeb698f6ac6cec1f6deda5e5b
|
|
|
Goto Forum:
Current Time: Wed May 14 20:12:01 CEST 2025
Total time taken to generate the page: 0.00402 seconds
|