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