Hello

I have been looking at Inline C and Inline CPP. I have compiled the simple
examples shown on the cpan site.

What I need to do is to call a method in an external shared library. I have
the .so and the necessary header files. How to do do the #include's in my
perl script ? ARe there any examples ?

I am actually confused about two main areas

1. When you want to embed your C++ code, there seems to be a format that
looks like a scripting "here" document , like this:


   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";


OR you seem to be able to put your C code after the perl code in section
like this

__END__
__CPP__

int add(int x, int y) {
        return x + y;
}

I am not sure what the difference is or which one is better. In my case, I
have some methods but they are in .so files.

2. How/where/when you should include the LIBS =>, DATA=> constructs. I have
seen examples with them at the end, at the start.

Thanks forany help/advice.



Chris





Reply via email to