Hi moritz The code in NewModule_bla3.xs is as follows. The cpp code that I use was compiled with no problems and it is inside a shared object that resides near the module I try to build (at /users/nirf/perlTrials/inlineExample/libmain.so as indicated in the .pm file). NewModule_bla3.xs : &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& #ifndef bool #include <iostream.h> #endif extern "C" { #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "INLINE.h" } #ifdef bool #undef bool #include <iostream.h> #endif ENDMODULE = NewModule_b1a3 PACKAGE = NewModule PROTOTYPES: DISABLE &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& The cpp file : &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& #include <stdio.h> #include "main.h" //extern int funcOuter(int); MyClass::MyClass(const char * a_my_favorite_argument) { printf("I'm constructing : %s \n",a_my_favorite_argument); _my_favorite_argument.append(a_my_favorite_argument); } MyClass::~MyClass() { printf("Destruction : %s \n",_my_favorite_argument.c_str()); } int MyClass::wow() { printf ("I am inside wow \n"); return 12 / 3; } int func(const int&); int main (int argc, char* argv[]) { //calling to a function from another so //funcOuter(4); printf ("hello \n"); int x = 10; func(x); return 0; } int func (const int& x) { printf ("in func : %d \n",x); return 0; } &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& The header file &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& #ifndef _nir_test_main #define _nir_test_main #include <string> using namespace std; class MyClass { public: MyClass(const char*); ~MyClass(); int wow(); private : string _my_favorite_argument; }; #endif &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Thanks, Nir

In reply to Re^2: inline in a perl module by nirf1
in thread inline in a perl module by nirf1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.