Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
alendar is currently offline  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
Re: One way to share IML across obj files [message #24992 is a reply to message #24986] Sat, 06 February 2010 22:56 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
Thank you Alendar

I remember to do something like this some time ago and I also used the "1000 monkeys writing Shakespeare" technique (Smile ).

This is something interesting to be in docs.


Best regards
Iñaki
Re: One way to share IML across obj files [message #25008 is a reply to message #24986] Sun, 07 February 2010 10:19 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, the "standard" is to put iml_header into your package header and iml_source into any single source file, while repeating lines:

#define IMAGECLASS MyImages
#define IMAGEFILE "project.iml"


twice.

Note that TheIDE can generate these magic includes for you, righclick editor and choose Insert/Insert .iml.

Mirek
Re: One way to share IML across obj files [message #25086 is a reply to message #25008] Tue, 09 February 2010 23:37 Go to previous messageGo to next message
alendar is currently offline  alendar
Messages: 47
Registered: January 2010
Location: Idaho, USA
Member
Cool! I didn't see that.

cd7651feeb698f6ac6cec1f6deda5e5b
Re: One way to share IML across obj files [message #25094 is a reply to message #25086] Wed, 10 February 2010 08:17 Go to previous message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
alendar wrote on Tue, 09 February 2010 23:37

Cool! I didn't see that.

Yes it is!

I will click right button more frequently. You can find nice surprises Smile


Best regards
Iñaki
Previous Topic: TopMost
Next Topic: Clipped frame
Goto Forum:
  


Current Time: Thu Apr 18 18:45:01 CEST 2024

Total time taken to generate the page: 0.02218 seconds