Problem passing parameters usign DynaLib

From: jcastillo (jcastillo_at_2vias.com.ar)
Date: 02/27/04

  • Next message: James Willmore: "Re: DBI problems"
    Date: 27 Feb 2004 05:17:12 -0800
    
    

    Hi,

    I want to call functions that I have in dynamic library (written in C)
    from a perl program. I'll try it using the module DynaLib but Iīm
    having problems passing parameters to the function: the function is
    called (I Know that because i put a print sentence to debug and I can
    see the message) but when I print the arguments (within the library
    function) I can only see garbage.
    My function receive arguments of type char* and return an int.
    What can be wrong?
    See the perl code

    use C::DynaLib;
    use sigtrap;

    $lib = new C::DynaLib("libmerlinstringclient.so");
    if (! $lib) {
        die "canīt load ", DynaLoader::dl_error(), "\n";
    }

    $normPeople = $lib->DeclareSub("normalize", "i", "p", "p", "i", "p",
    "p",
     "p", "p");
    if (! $normPeople) {
        die "canīt declare ", DynaLoader::dl_error(), "\n";
    }

    $name = " ";
    $surname = " ";
    $type = " ";
    $sex = " ";
    $host = "mafalda";
    $port = "8887";
    $timeout = 5000;
    $fullName = "Yolanda Arthur";

    $result = &{$normPeople}($host, $port, $timeout, $fullName, $name,
    $surname, $type, $sex);
    print "NAME: $name, surname: $surname\n";


  • Next message: James Willmore: "Re: DBI problems"

    Relevant Pages