Hi all,
I use perl version 5.8.6.
1.When I use std::string datatype of c++ in the constructor, perl is not
recognising the constructor and gives error 'cannot locate new'.So I have
used char*.
2.This code when used as stand alone script with hashbang(#!) line works
fine.But when I add 'pachage chkthr; and 1; to make it a module gives error
'cannot locate object method new via package thready.(perhaps you forgot to
load thready)'.
3.The calling script had ' use chkthrd; ' and then '&chkthrd::call;'
The simplified code (reproducing error) follows:
package chkthrd;
use Inline CPP;
sub call{
my $ip = "192.168.1.10";
my $ab = new thready($ip);
$ab->start();
$ab->joining();}
__END__
__CPP__
class thready
{ private:
pthread_t mythr;
char* id;
public:
thready(char* idstr){id=idstr;std::cout<<id;}
~thready(){std::cout<<"over";}
void start(){std::cout<<"start"}
void joining(){std::cout<<"join"}
};
1;
to avoid the error I wrote main too in C++ (creating object too in c++ and
called start and joining from c++).But how do I call that function from
other module, if I switch to that solution?
Thanks a lot for any help,
kararu.