<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    On 01/30/2011 10:39 PM, Tamas Szekeres wrote:
    <blockquote
      cite="mid:AANLkTik22h+xTWVM4C0uYXJLUpw4TME8d4gSVhA7Bfwe@mail.gmail.com"
      type="cite">Ari,<br>
      <br>
      Assuming you did mention to compile the Perl bindings with MinGW
      could you describe the steps of the compilation in more detail?
      (by using the files downloaded from <a moz-do-not-send="true"
        href="http://vbkto.dyndns.org/sdk">http://vbkto.dyndns.org/sdk</a>.)
      Which packages should be installed as the prerequisites of the
      compilation?<br>
      I admit I'm not an expert in MinGW but it would be quite helpful
      on my side to be able to reproduce the issue you are talking
      about. I would also be curious to know how the perl tests are
      executed in this case.<br>
    </blockquote>
    <br>
    Tamas,<br>
    <br>
    First, this page:
    <a class="moz-txt-link-freetext" href="http://www.transmissionzero.co.uk/computing/building-dlls-with-mingw/">http://www.transmissionzero.co.uk/computing/building-dlls-with-mingw/</a>
    has an alarming advice: "Therefore [when using stdcall], if you
    intend to have binary compatibility between MinGW and MSVC builds of
    your DLL, it’s necessary to change the names of the exported
    functions".<br>
    <br>
    The steps: Download and install your DLL package; download the
    respective swig/perl folder (this really should be a separately
    downloadable package distro); Edit Makefile.PL to find gdal17.dll;
    run perl Makefile.PL; run make.bat.<br>
    <br>
    That assumes of course you have a working perl. Strawberry perl
    should be usable as it is MinGW. Also in fact Makefile.PL should
    find the import library for which I used gdal17.dll.a, which I
    created with pexports and dlltool.<br>
    <br>
    Perl tests are run simply as "make test", which runs the test code
    without installing anything.<br>
    <br>
    Jürgen, no I did not yet try .lib.<br>
    <br>
    Ari<br>
    <br>
    <blockquote
      cite="mid:AANLkTik22h+xTWVM4C0uYXJLUpw4TME8d4gSVhA7Bfwe@mail.gmail.com"
      type="cite"><br>
      Best regards,<br>
      <br>
      Tamas<br>
      <br>
      <br>
      <div class="gmail_quote">2011/1/30 Ari Jolma <span dir="ltr">&lt;<a
            moz-do-not-send="true" href="mailto:ari.jolma@gmail.com">ari.jolma@gmail.com</a>&gt;</span><br>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <div text="#000000" bgcolor="#ffffff"> 29.1.2011 20:43, Tamas
            Szekeres kirjoitti:
            <div class="im">
              <blockquote type="cite">Ari,<br>
                <br>
                I would be eager to know the exact use case you have.
                Did you have some errors provided by the linker in this
                case?<br>
              </blockquote>
              <br>
            </div>
            For the stdcall functions I added entries like this<br>
            <br>
            _CPLDefaultErrorHandler@12<br>
            CPLDefaultErrorHandler = _CPLDefaultErrorHandler@12<br>
            <br>
            to the .def file. I create the .dll.a, which is the import
            library, with dlltool from the .def.<br>
            <br>
            There are no errors from the linker. If I leave the stdcall
            entries as they are from pexports, i.e., just<br>
            <br>
            _CPLDefaultErrorHandler@12<br>
            <br>
            The linker complains about undefined reference to
            `CPLDefaultErrorHandler'<br>
            <br>
            However, running the Perl tests fail with "The procedure
            entry point CPLDefaultErrorHandler could not be located in
            the dynamic link library gdal17.dll". This is no wonder
            since the Perl bindings GDAL.dll imports
            CPLDefaultErrorHandler from gdal17.dll. I believe this
            because I'm misusing the .def file or dlltool does not
            understand that CPLDefaultErrorHandler is an alias to
            _CPLDefaultErrorHandler@12.<br>
            <br>
            I saw a web page which seemed to say that this is a known
            problem in dlltool and it had a small hack for dlltool.c to
            fix the problem, but I don't find the page just now and I've
            not yet tried hacking the dlltool.c (it seems quite
            possible).<br>
            <br>
            I think the cdecl functions work ok.<br>
            <br>
            If I compile GDAL in MSYS, all functions are exported cdecl.<br>
            <font color="#888888"> <br>
              Ari</font>
            <div>
              <div class="h5"><br>
                <br>
                <br>
                <blockquote type="cite">It would indeed be a problem how
                  the various compilers decorate their export functions
                  in a different way. It looks like the
                  __declspec(dllexport) option (this is what is used in
                  GDAL) provides different names with MSVC and MinGW by
                  default. If we want to compile the dlls in a portable
                  way we should probably get back to an alternative
                  method like .def file or "#pragma comment( linker,
                  "/export:FuncName" )" when exporting the functions.<br>
                  <br>
                  The article you are referring to describes another way
                  of providing a portable version that is:<br>
                  1. Compile the dll as it is now (the functions
                  exported with__declspec(dllexport)) <br>
                  2. Extract the export functions in a .def file by
                  using pexports<br>
                  3. Replace the function names with their undecorated
                  names in the .def file<br>
                  4. Recompile the dll with this new export definition
                  file.<br>
                  <br>
                  I'm keen to give it a try if I get some further info
                  about how to test this on the other side.<br>
                  <br>
                  <br>
                  Best regards,<br>
                  <br>
                  Tamas<br>
                  <br>
                  <br>
                  <br>
                  <br>
                  <div class="gmail_quote">2011/1/29 Ari Jolma <span
                      dir="ltr">&lt;<a moz-do-not-send="true"
                        href="mailto:ari.jolma@gmail.com"
                        target="_blank">ari.jolma@gmail.com</a>&gt;</span><br>
                    <blockquote class="gmail_quote" style="margin: 0pt
                      0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
                      204, 204); padding-left: 1ex;"> Did anybody else
                      try to use the now standard Visual Studio built
                      GDAL DLL (which was much discussed some time ago
                      here and is now available from Tamas' site) in a
                      MinGW environment?<br>
                      <br>
                      I spent some time a week or two ago on the issue,
                      but I had a hard time, which AFAIK is because the
                      DLL mixes two function export methods and thus
                      using the standard tools seems difficult if not
                      impossible (I already downloaded the sources for
                      latest GNU dlltool and considered hacking it...)<br>
                      <br>
                      The best page about the issue I found so far is
                      this: <a moz-do-not-send="true"
                        href="http://wyw.dcweb.cn/stdcall.htm"
                        target="_blank">http://wyw.dcweb.cn/stdcall.htm</a><br>
                      <br>
                      Anybody have any ideas? Is my observation about
                      the two export methods correct and why is that?<br>
                      <font color="#888888"> <br>
                        Ari</font>
                      <div><br>
                        <br>
                        On 01/29/2011 04:59 AM, Frank Warmerdam wrote:<br>
                        <blockquote class="gmail_quote" style="margin:
                          0pt 0pt 0pt 0.8ex; border-left: 1px solid
                          rgb(204, 204, 204); padding-left: 1ex;">
                          Folks,<br>
                          <br>
                          I have had good success with the GDAL 1.8
                          upgrade and I have now thrown<br>
                          the switch migrating it into the production
                          version of OSGeo4W.<br>
                          <br>
                          I have upgraded "gdal", "gdal-python",
                          "gdal-mrsid" and "gdal-autotest".<br>
                          I have yet to upgrade the ecw, and sde related
                          drivers, and I have not<br>
                          upgraded the java bindings.  I will try to
                          work on them tomorrow.<br>
                          <br>
                          The gdal15dll package was created for backward
                          compatability and should<br>
                          be automatically pulled in.  It seems to be
                          working fine for OpenEV.<br>
                          <br>
                          I would encourage folks building packages to
                          update, and rebuild them<br>
                          using the current GDAL.  The GDAL include
                          files in C:\OSGeo4W\include<br>
                          and libraries in C:\OSGeo4w\lib should now be
                          for 1.8.<br>
                          <br>
                          Note that the new GDAL package is built using
                          Visual Studio 2008<br>
                          Express instead of 2003.  If you are using the
                          C++ API this may cause<br>
                          issues but if you use the C API it should be
                          invisible.<br>
                          <br>
                          Let me know of problems.<br>
                          <br>
                          Best regards,<br>
                        </blockquote>
                        <br>
                      </div>
                      <div>
                        <div>
                          _______________________________________________<br>
                          gdal-dev mailing list<br>
                          <a moz-do-not-send="true"
                            href="mailto:gdal-dev@lists.osgeo.org"
                            target="_blank">gdal-dev@lists.osgeo.org</a><br>
                          <a moz-do-not-send="true"
                            href="http://lists.osgeo.org/mailman/listinfo/gdal-dev"
                            target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
                        </div>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                  <div style="padding: 0px; margin-left: 0px;
                    margin-top: 0px; overflow: hidden; word-wrap:
                    break-word; color: black; font-size: 10px;
                    text-align: left; line-height: 130%;"> </div>
                  <pre><fieldset></fieldset>
_______________________________________________
gdal-dev mailing list
<a moz-do-not-send="true" href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a moz-do-not-send="true" href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
                </blockquote>
                <br>
              </div>
            </div>
          </div>
          <br>
          _______________________________________________<br>
          gdal-dev mailing list<br>
          <a moz-do-not-send="true"
            href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
          <a moz-do-not-send="true"
            href="http://lists.osgeo.org/mailman/listinfo/gdal-dev"
            target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
        </blockquote>
      </div>
      <br>
      <div style="visibility: hidden; left: -5000px; position: absolute;
        z-index: 9999; padding: 0px; margin-left: 0px; margin-top: 0px;
        overflow: hidden; word-wrap: break-word; color: black;
        font-size: 10px; text-align: left; line-height: 130%;"
        id="avg_ls_inline_popup">
      </div>
    </blockquote>
    <br>
  </body>
</html>