in reply to SWIG or Inline::CPP

Hi

Inline::CPP lets you write Perl subroutines and classes in C++. You don't have to learn XS or SWIG, you can just put code right "inline" in your source.

use Inline CPP => <<'END'; class JAxH { public: JAxH(char *x); SV* data(); private: SV *dat; }; JAxH::JAxH(char *x) { dat = newSVpvf("Just Another %s Hacker", x); +} SV* JAxH::data() { return dat; } END print JAxH->new('Inline')->data(), "\n"; When run, this complete program prints: Just Another Inline Hacker.

"Keep pouring your ideas"

Replies are listed 'Best First'.
Re^2: SWIG or Inline::CPP
by Anonymous Monk on Dec 06, 2005 at 09:05 UTC
    Hi,
    thanks for your suggestion. But is it necessary that the function declaration and definition should be enclosed within "END" blocks? I mean if the declaration is in .h and definition in .cpp do i have to create a separate file merging these two?
    rgds
    AB
      Hi, This is just what I want to ask: "if the declaration is in .h and definition in .cpp do i have to create a separate file merging these two in a perl file?? " Thanks Kelvin