<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - allow using gfile.h with glib"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107608">107608</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>allow using gfile.h with glib
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>poppler
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>poppler-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chpe@gnome.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=141172" name="attach_141172" title="proposed patch">attachment 141172</a> <a href="attachment.cgi?id=141172&action=edit" title="proposed patch">[details]</a></span>
proposed patch

(Moved to a separate bug as per <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - add API to create PopplerDocument from FD"
   href="show_bug.cgi?id=107599#c1">bug 107599 comment 1</a>.)

In <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - add API to create PopplerDocument from FD"
   href="show_bug.cgi?id=107599">bug 107599</a> I have a need to include goo/gfile.h in
poppler/glib/poppler-document.cc together with <glib.h> However doing so leads
to a compile error, since goo/gfile.h defines a "GDir" class which ufortunately
is also the name of a glib
type[<a href="https://gitlab.gnome.org/GNOME/glib/tree/master/glib/gdir.h">https://gitlab.gnome.org/GNOME/glib/tree/master/glib/gdir.h</a>]:

..../include/glib-2.0/glib/gdir.h:37:22: Fehler: conflicting declaration
»typedef struct _GDir GDir«
 typedef struct _GDir GDir;
                      ^~~~
..../poppler/poppler/goo/gfile.h:199:7: Anmerkung: previous declaration as
»class GDir«
 class GDir {
       ^~~~

[From <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - add API to create PopplerDocument from FD"
   href="show_bug.cgi?id=107599#c1">bug 107599 comment 1</a>]:
<span class="quote">> I'm really not happy when we get workarounds in our code because 
> we collide with other repos type names, why should we be the ones
> adding workarounds and not the other codes?</span >

I don't see a way to suppress glib's GDir. <glib.h> includes gdir.h and
glib-autocleanups.h. The gdir.h file's contents is guarded by #ifndef
__G_DIR_H__ which we could pre-define to skip its contents, but the <glib.h>
also includes <glib-autocleanups.h> which requires gdir.h and has itself no
such guard. Also these include guard names are not part of the glib API, they
are internal and we cannot rely on them.

OTOH poppler controls its own names, so if we work around this inside poppler,
we can rely on it.

The attached patch enables this by omitting the GDir (and GDirEntry) classes
from goo/gfile.h when GFILE_NO_GDIR is #define'd.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>