FAQ
I am trying to get DBD-Sybase (Sybase OpenClient 11.1) going under
Cygwin using Perl 5.8.

Following the Cygwin instructions to produce DLL wrapper libs for
libcs.dll and libct.dll, I got a clean compile, after fixing csconfig.h
to
#define CS_PUBLIC __stdcall
So that the DLL calling conventions are respected.

However, the resulting blib/arch/auto/DBD/Sybase/Sybase.dll cannot be
loaded dynamically, giving me the following error:
/usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0,
'blib/lib', 'blib/arch')" t/*.t
t/autocommit....install_driver(Sybase) failed: Can't load
'blib/arch/auto/DBD/Sybase/Sybase.dll' for module DBD::Sybase: dlopen:
Win 32 error 127 at
/usr/lib/perl5/5.8.0/cygwin-multi-64int/DynaLoader.pm line 229.

I know from other platforms that this indicates some sort of trouble
loading the shared library, however I can't nail it further down.

For instance, trying a little test program to
'dlopen("blib/arch/auto/DBD/Sybase/Sybase.dll", RTLD_NOW)' fails
returning a null,
The error is 'Permission denied'. Compare that to applying the same
test program to any other perl dynamic DLL, which works fine.

I also used a DLL analyzer utility to check dependencies, which are all
satisfied. However I'm not familiar enough with DLLs, so I might be
missing something fairly obvious.

So I'm stomped, and don't even know whether I'm hitting a Cygwin, a Perl
or a Sybase specific problem here.
I can definitely provide more detail if necessary, just let me know what
you'd like to see.

Looking through mail archives, I couldn't find references to DBI/DBD
being used much under Cygwin. Is this just too hard,
or is the ActiveState port the only way to go?

Thanks.

Martin Schulz

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.481 / Virus Database: 277 - Release Date: 13/05/2003

Search Discussions

  • Martin Schulz at May 18, 2003 at 5:18 pm
    Ok, I found out what I was missing. The Cygwin User's Guide suggests
    creating the DLL import library for foo.dll thus:

    dlltool --def foo.def --dllname foo.dll --output-lib foo.a

    However, this results in an attempt to import sybmols of the form
    foo3parm@12
    foo1parm@4

    from the DLL. That's OK as long as it's a gcc-built DLL, however MSVC
    just exports the names as foo3parm / foo1parm.
    I was erroneously assuming the '@nn' symbols where a convention used by
    the MSVC tools, but they aren't.
    A look at the DLL with a 'PE' tool should reveal the exports easily
    (which I overlooked).

    The way to achieve this is the -k otpion of dlltool:
    dlltool -k --def foo.def --dllname foo.dll --output-lib foo.a

    And of course make sure the functions are marked as using __stdcall
    calling conventions.

    Now I'm in business connecting to my database.

    A big thanks to all involved, this is coooooooooooooool.

    Martin
    -----Original Message-----
    From: Martin Schulz
    Sent: May 17, 2003 5:59 PM
    To: dbi-users@perl.org
    Subject: DBD-Sybase using Cygwin?


    I am trying to get DBD-Sybase (Sybase OpenClient 11.1) going
    under Cygwin using Perl 5.8.

    Following the Cygwin instructions to produce DLL wrapper libs
    for libcs.dll and libct.dll, I got a clean compile, after
    fixing csconfig.h to #define CS_PUBLIC __stdcall So that the
    DLL calling conventions are respected.

    However, the resulting blib/arch/auto/DBD/Sybase/Sybase.dll
    cannot be loaded dynamically, giving me the following error:
    /usr/bin/perl.exe "-MExtUtils::Command::MM" "-e"
    "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
    t/autocommit....install_driver(Sybase) failed: Can't load
    'blib/arch/auto/DBD/Sybase/Sybase.dll' for module
    DBD::Sybase: dlopen: Win 32 error 127 at
    /usr/lib/perl5/5.8.0/cygwin-multi-64int/DynaLoader.pm line 229.

    I know from other platforms that this indicates some sort of
    trouble loading the shared library, however I can't nail it
    further down.

    For instance, trying a little test program to
    'dlopen("blib/arch/auto/DBD/Sybase/Sybase.dll", RTLD_NOW)'
    fails returning a null, The error is 'Permission denied'.
    Compare that to applying the same test program to any other
    perl dynamic DLL, which works fine.

    I also used a DLL analyzer utility to check dependencies,
    which are all satisfied. However I'm not familiar enough
    with DLLs, so I might be missing something fairly obvious.

    So I'm stomped, and don't even know whether I'm hitting a
    Cygwin, a Perl or a Sybase specific problem here. I can
    definitely provide more detail if necessary, just let me know
    what you'd like to see.

    Looking through mail archives, I couldn't find references to
    DBI/DBD being used much under Cygwin. Is this just too hard,
    or is the ActiveState port the only way to go?

    Thanks.

    Martin Schulz

    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.481 / Virus Database: 277 - Release Date: 13/05/2003


    ---
    Incoming mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.481 / Virus Database: 277 - Release Date: 13/05/2003
    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.481 / Virus Database: 277 - Release Date: 13/05/2003

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbi-users @
categoriesperl
postedMay 17, '03 at 9:59p
activeMay 18, '03 at 5:18p
posts2
users1
websitedbi.perl.org

1 user in discussion

Martin Schulz: 2 posts

People

Translate

site design / logo © 2022 Grokbase