Hi, All. Is there any way to process data-types defined in .so library ? I've used code like this :
package SO; use DynaLoader; sub new { my $class = shift; my $libname = shift; my $so = DynaLoader::dl_findfile( $libname ); die 'Failed to find .so for '.$libname unless defined( $so ); my $lib = DynaLoader::dl_load_file( $so, @_ ); die 'Failed to load '.$so unless $lib; return bless [ $lib, $so ], $class; }; sub AUTOLOAD { my $self = shift; my $sub = $AUTOLOAD; $sub =~ s/.*\:\://; warn 'called DL'; return $self->call( $sub, @_ ); }; sub DESTROY { my $self = shift; DynaLoader::dl_unload_file( $self->[0] ); }; sub call { my $self = shift; my $sym = shift; my $symref = DynaLoader::dl_find_symbol( $self->[0], $sym ); die 'failed to find '.$sym.' in '.$self->[1] unless $symref; DynaLoader::dl_install_xsub( $sym, $symref ); return &$sym( @_ ); }; 1;
------ I've tried to install C::DynaLib but get failed on tests in "make test". At now I'm looks over code of C::DynaLib and many others. Showed ecample works good with method which is like that
use SO; my $so = SO->new('some.so'); my $string = $so->get_some_string();#correct result my $x = { a => 'b', c => 123 }; my $r = $so->change_this_argument( $x );#get error from .so about wron +g arguments, but the arguments definetly correct. my $r2 = $so->accept_this_argument( $x );#get same error.
My question is how I should to repack $x or it's components to make them clear for original .so library. .so library is third party library which sources I have but will not like to change ( it comes from yum official repositories ).

In reply to DynaLoader and data types by Anonymous Monk

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.