> Several solutions have been designed by Pierre Habouzit, but I cannot
> even think about applying them. Like adding:
> 
> #undef readdir
> #include <dirent.h>
> 
> Before:
> DynamicQueryFactory::CDynamicQueryFactory(string inDirectoryName){
> 
> which works, of course, but is totally ugly IMHO :-)

  I also find this completely awful, and don't want to see anyone think
I can consider it a good patch ;)

  another way is to patch the incriminated file that way:

  at the begining, add:

------8<-------------------------------------------------------

#include <dirent.h>

typedef dirent *(readdir_fun)(DIR *dir);
static readdir_fun *const stupid_readdir_alias = &readdir;

------>8-------------------------------------------------------

  and of course use (*stupid_readdir_alias)(lDirectory) in the while
loop.

  this is not very nice, but at least is portable.



  the danger in the previous approach is that readdir is (sometimes)
already a macro in dirent.h, and if it has been included somewhere in
the includes chain, then we will undef it for good, and have no
implementation for it (since the second include of <dirent.h> will just
be skipped because of include guards).


  Note that I consider that it's a real perl problem here.
-- 
·O·  Pierre Habouzit
··O                                                [EMAIL PROTECTED]
OOO                                                http://www.madism.org

Attachment: signature.asc
Description: Digital signature

Reply via email to