On Wednesday 18 June 2008 06:34:26 Sisyphus wrote:
> There's another subtle difference.
> I replaced:
>
> const char* version(void)
>
> with:
>
> char * version()
Yep, accounted for, KDE::versionString() returns const char *, but that was
solvable with a cast.
Just to be clear, in all situations it's compiling cleanly, it's just not
resolving the method when a heredoc isn't used.
> > So I tried it out, and 'lo and behold I get that error when I compile my
> > C++
> > snippet from an external file.
> >
> > If I provide it as a string, it works great. The exact same code.
>
> So ... your mimelib.c contains:
>
> -------------------------------
> #include <iostream>
> #include <kdeversion.h>
>
> char* version() {
> return ::KDE::versionString();
> }
>
char* version() {
return (char*) ::KDE::versionString();
}
Essentially, yes.
> Make sure there's a newline at the end of the file. (Otherwise Inline::CPP
> will prolly create a corrupt XS file.)
I'll check for this, but again, it's compiling.
> I'm also unsure about the "return ::KDE::versionString();" part, too.
> Assuming that "versionString()" is a libkio.a or libkdecore.a function, I
> would think you just want:
versionString() is in the KDE namespace. It's no different than trying to call
a perl subroutine that exists in package KDE from main without qualifying the
package.
I could certainly attempt some trickery to reassign it to std, but like I
said, it compiles everytime and runs cleanly and as expected when it's in a
heredoc.
> return versionString();
>
> ... and the perl file contains:
>
> -------------------------------
> package MIME::KDE;
>
> use warnings;
> use strict;
> use version qw(qv);
>
> our $VERSION = qv('0.01');
>
> use File::Basename qw(dirname);
>
> use Inline CPP =>
> Config =>
> LIBS => ['-lkio', '-lkdecore'],
> INC => ['-I /usr/include/kde', '-I
> /usr/include/qt3'],
> ENABLE => 'STD_IOSTREAM'
> ;
> use Inline CPP => dirname(__FILE__).'/src/mimelib.cpp';
> 1;
Correct.
> For me, that faithfully outputs:
> my version is 0.01
>
> Are we getting close to a resolution ?
Very much so. Technically I have a working product at this point, however I'd
really prefer to not use a heredoc. I imagine it's something very subtle
(e.g., I snipped the POD in the document but there is an __END__ in there,
maybe that's confusing Inline). I've got some other matters to attend to
today and will give it a solid try in a few hours.
I'll scour your examples and see if I have anything different that I may have
overlooked.
Thanks again for your help.
-Erik