class ae_util { public: ae_util(); ~ae_util(); static string str_time( char * str_fmt = "%Y%2m%2d_%2H%2M%2S" ); ......... #### // **************************** ae_util::ae_util() { } // **************************** ae_util::~ae_util() { } /************************************************************ ************************************************************/ string ae_util::str_time( char * str_fmt ) { string sres; char str_res[100]; const time_t now = time(0); strftime( str_res, 100, str_fmt, localtime( &now ) ); sres = string(str_res); return sres; } #### $ gcc --shared -o ae_util.so ../xxx/yyyy/ae_util.o #### #!/usr/bin/perl use Inline CPP => Config => LIBS => './ae_util.so'; use strict; print " test1 ", ae_util::strtime( '%Y%2m%2d_%2H%2M%2S' ); #### #!/usr/bin/perl
# use Inline CPP => Config => MYEXTLIBS => './ae_util.so'; use Inline CPP => Config => LIBS => './ae_util.so'; use strict; my $obj = new ae_util(1); print " test1 ", $obj->strtime( '%Y%2m%2d_%2H%2M%2S' ); ##
## Can't locate object method "new" via package "ae_util" (perhaps you forgot to load "ae_util"?) at ./inline2.pl line 7.