Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

strawberry perl yields a "Invalid access to memory location"

by wannabeperlguru (Initiate)
on Sep 26, 2011 at 13:11 UTC ( #927856=perlquestion: print w/ replies, xml ) Need Help??
wannabeperlguru has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I am trying to switch from ActivePerl 5.10.1 build 1008 to strawberry perl 5.10.1 portable edition. I am running a perl script using the module FCGI, trying to access an Oracle database via DBD::ODBC and get the following error message:
ERROR: 'Can't load 'C:/Perl/perl/site/lib/auto/FCGI/FCGI.dll' for modu +le FCGI: load_file: Invalid access to memory location at C:/Perl/perl +/lib/DynaLoader.pm line 200.

The error does not show up when I use DBD::Oracle or when I use ActivePerl (no matter whether I use DBD::ODBC or DBD::Oracle). I analysed the script with Dependency Walker (profiling the perl process) to see where the FCGI.DLL gets loaded in memory (0x62EC0000 for DBD::Oracle, 0x06370000 for DBD::ODBC). The ImageBase of FCGI.DLL is 0x62EC0000, so obviously strawberry-perl has a problem if a dll is not loaded where the dll wants to be loaded (which may happen if another dll comes first at that special address). This seems to be a bug of the used mingw-toolchain (see bug 3322937 of mingw-bugtracker at sourceforge). I tried also with strawberry-perl 5.12 (newer version of mingw), same problem.

Now my questions are:

  • as strawberry-perl itself and all of the modules are compiled with mingw, is it safe to use strawberry-perl at all? I fear that this problem could happen again with any other dll?
  • how can I fix FCGI.DLL? I know that for a similar cygwin problem, there is /bin/rebaseall, is there something similar for mingw?

thanks for any advice

Comment on strawberry perl yields a "Invalid access to memory location"
Download Code
Re: strawberry perl yields a "Invalid access to memory location"
by Util (Priest) on Sep 26, 2011 at 14:42 UTC

    Microsoft's editbin is similar to Cygwin's rebaseall. Try using `editbin /rebase` to rebase FCGI.DLL.

    If that does not fix your problem, then please post a program with the least amount of code that still triggers the error. That way, everyone who wants to help will be running the same test code.

Re: strawberry perl yields a "Invalid access to memory location"
by Anonymous Monk on Sep 27, 2011 at 01:32 UTC

      Ok, took the time to read the node which deals with linking and updated my initial post to include a direct link to sourceforge... looks way better now!

      Yes, I used cpan to update outdated and install missing modules, so everything should be compiled/linked using the mingw-toolchain. I tried both strawberry-perl 5.10 and 5.12. The version numbers of the used programs:

      • 5.10:
        • gcc: gcc (GCC) 3.4.5 (mingw-vista special r3)
        • g++: g++ (GCC) 3.4.5 (mingw-vista special r3)
        • ld: GNU ld version 2.17.50 20060824
      • 5.12:
        • gcc: gcc (GCC) 4.4.3
        • g++: g++ (GCC) 4.4.3
        • ld: GNU ld (GNU Binutils) 2.20.51.20100123

Re: strawberry perl yields a "Invalid access to memory location"
by syphilis (Canon) on Sep 27, 2011 at 05:46 UTC
    strawberry-perl has a problem if a dll is not loaded where the dll wants to be loaded (which may happen if another dll comes first at that special address)

    What happens if you try to load FCGI, and no other module:
    perl -MFCGI -e 1
    I'm thinking it will still fail to load - even though (I assume) there's then no other dll that "comes first at that special address".
    Basically, for no good reason, I feel that you might not have got the diagnosis right.

    I think that another way of checking to see whether it can be loaded in isolation might be to call Win32.pm's Win32::LoadLibrary('C:/Perl/perl/site/lib/auto/FCGI/FCGI.dll') though, I guess by the time perl has fired up and Win32 has loaded, there are already at least 2 dll files that have been loaded.

    I fear that this problem could happen again with any other dll?

    I guess it could. But this must be a very rare occurrence. I've been using MinGW for years and have not yet struck it, nor had I heard of it before today.

    how can I fix FCGI.DLL? I know that for a similar cygwin problem, there is /bin/rebaseall, is there something similar for mingw?

    Best place to would ask about this would be on the mingw64 mailing list, since these are the people that provided the mingw compiler that Strawberry Perl uses.

    Cheers,
    Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://927856]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2014-09-21 22:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls