[AD] DAllegro 'export' crap hopefully fixed

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Bad luck that tjaden (Peter Wang?) improved the fix.sh script just when I was working on this. But I guess we both saw what Matthew L. was doing, and decided to do something about this annoyance.

The reason I haven't done this before is a) it requires a relatively new compiler version and b) it took me five hours of tedious work. But now it's done.

Linking DAllegro apps statically with Allegro without using a script to remove 'export' should work now. Just add -version=STATICLINK to the command line when compiling, and the 'export' keyword will not be included anywhere.

On other platforms than Windows, 'export' is never used, and STATICLINK has no effect.

This is interesting part of the code:

---
template _export(char[] def)
{
   static if (ADD_EXPORT)
      const char[] _export = "export " ~ def;
   else
      const char[] _export = def;
}
---

Used like this:
mixin(_export!("extern extern (C) cpu_family;"));

So it's really a poor man's preprocessor... But at least the problem is now contained within the code itself. Let's hope D gets a cleaner way of doing this in the future.

I'll try to actually test static linking if I get some time tomorrow.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/