in reply to Re^2: Writing threadsafe perl extensions
in thread Writing threadsafe perl extensions

What happens with this?

#!perl -slw use threads; sub t1 { eval{ use Math::GMP }; my $mbi = Math::GMP->new($_[0]); return $mbi; } my $th1 = threads->new(\&t1, '123' x 11); my $ret1 = $th1->join; print Math::GMP::get_str_gmp($ret1, 10);

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^4: Writing threadsafe perl extensions
by syphilis (Archbishop) on Oct 21, 2007 at 23:48 UTC
    What happens with this?

    Still segfaults, unfortunately.

    Cheers,
    Rob

      Sorry I can't help more. I grabbed Math::GMP and whilst it built fine, but craps out very early in make test with "The procedure entrypoint __gmpz_sqrt could not be located in the DLL gmp.dll". There seems to be a fundemental conflict between an XS extension to call functions in a file called gmp.dll, itself being called gmp.dll.

      (As an aside, why do so few of these modules that have dependancies on third party libraries never bother to give pointers to where to get them, or even mention the dependancy, in the POD?)


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Sorry I can't help more

        That's ok - you've alrready gone to more trouble than is warranted.

        There seems to be a fundemental conflict between an XS extension to call functions in a file called gmp.dll, itself being called gmp.dll

        Yes (on Win32 anyway), the dll that perl builds needs to have a different name to the the third party dll. I struck a similar problem trying to build PGPLOT. One workaround is to have perl build a dll with a different extension by specifying in WriteMakefile() something like:
        DLEXT => 'xs.dll',
        The bootstrap() call in GMP.pm then also needs to be changed:
        if($^O =~ /mswin32/i) { local $DynaLoader::dl_dlext = 'xs.dll'; bootstrap Math::GMP $VERSION; } else {bootstrap Math::GMP $VERSION}
        That should result in perl building a dll called gmp.xs.dll - which won't get confused with the gmp.dll that you already have.

        .. why do so few of these modules that have dependancies on third party libraries never bother to give pointers to where to get them, or even mention the dependancy

        Good question - and I can't really answer for Math::GMP. In my view, that info should be provided in the README - and I have GMP-based modules that do that. I guess it wouldn't hurt to duplicate that info in the POD - which I will do.

        Cheers,
        Rob