Sisyphus
Wed, 18 Jun 2008 06:37:41 -0700
----- Original Message ----- From: "Erik Hollensbe" <[EMAIL PROTECTED]>
. .
I thought it was interesting that you could get it to work and I couldn't; the only difference is that I was referencing an external file and you were usinga heredoc.
There's another subtle difference. I replaced: const char* version(void) with: char * version()Did you pick up on that ? (I changed it because it was necessary ... for me, anyway ... I don't think it compiled otherwise ... though it compiled ok in its original form iff the "namespace" stuff was present ... but then the version function couldn't be found :-)
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();
}
-------------------------------
Make sure there's a newline at the end of the file. (Otherwise Inline::CPP
will prolly create a corrupt XS file.)
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:
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;
-------------------------------
I can't think of a reason that would fail to find the version function. With
my modified version of mimelib.cpp (in the ./src directory) I ran the
following script:
-------------------------------
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 =>
ENABLE => 'STD_IOSTREAM'
;
use Inline CPP => dirname(__FILE__).'/src/mimelib.cpp';
my $z = MIME::KDE::version();
print $z, "\n";
-------------------------------
For me, that faithfully outputs:
my version is 0.01
Are we getting close to a resolution ?
Cheers,
Rob