Hi,
I've built the libproj library with mingw (for use with PDL on x64 Windows perl) but attempted access to that library fails at the build stage because both projects.h (from the libproj library) and winreg.h (from the mingw x64 compiler) define PVALUE.
Here's a simple script and consequent error message that hopefully makes the problem clear:
use warnings;
use Inline C => <<'EOC';
#include <projects.h>
SV * foo() {
printf("Hello World\n");
}
EOC
foo();
And the error it produces:
In file included from try_pl_f857.xs:6:
C:\_64\msys\1.0\local\include/projects.h:150: error: conflicting types
+ for 'PVALUE'
c:/_64/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/winreg.h:76: n
+ote: previous declaration of 'PVALUE' was here
dmake: Error code 129, while making 'try_pl_f857.o'
Line 150 of projects.h:
typedef union { double f; int i; char *s; } PVALUE;
and line 76 of winreg.h:
typedef PVALUEA PVALUE;
One solution is to change the typedef in projects.h to something else (I chose _P_VALUE), and to amend the other libproj source files accordingly, then re-compile and re-install the library. That's fairly simple as PVALUE crops up in only a few places ... and that works well.
But is there a smarter way to approach this sort of problem - something I could do in that Inline::C script that enables it to run without having to alter projects.h, and without having to remove the
#include <projects.h> ?
Cheers,
Rob
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.