Roger has asked for the wisdom of the Perl Monks concerning the following question:

Dear fellow monks,

Recently I have aquired version 12.0 of Sybase OpenClient, and my old DBD does not work any more. Well to be more specific, the perl script prints the error message "Invalid context version" at the "use DBD::Sybase" clause, and proceed with the rest of the code without problem.

I have done some research on the net, and found out that the warning message gets printed when the version of the DBD::Sybase driver was compiled with earlier version of Sybase OCS.

So I have downloaded the latest version of DBD-Sybase from CPAN, and tried to build the new Sybase.dll. By the way, I am using Borland C++ 5.5 on my XP system.

I ran perl Makefile.PL and created a Makefile. However, most of the directives in the Makefile were really geared towards Microsoft Visual C that I do not have. I have modified the Makefile to compile with the Borland compiler. The compilation had many errors, which I fixed one by one, and finally it created an empty DLL of only 2K in size. This cann't be right. But the compiler reported success on the build?!

By the way, the linker has complained about missing __turboFloat from root, which I have patched by adding unsigned long _turboFloat; to the dbimp.c file. And also it complained about the format of Perl58.lib and libct.lib etc., which I fixed by running the Borland implib utility on the DLL's.

My question is, has anyone here ever compiled DBD::Sybase with Borland C++ compiler before? If so, could you please offer some expert advise on how to setup the Makefile and environment to compile the DLL properly? Am I missing some command-line switches?

Your comment and help are greatly appreciated!

  • Comment on Compiling DBD::Sybase with Borland C++ 5.5

Replies are listed 'Best First'.
Re: Compiling DBD::Sybase with Borland C++ 5.5
by BrowserUk (Patriarch) on Oct 01, 2003 at 13:46 UTC

    Did you build your copy of perl with Borland? If not, then you probably on a hiding to nothing.

    Whilst DLLs ought to be independant of the compilers that produce them, my experience is that the DLLs produced when building perl extensions seem to have some peculiar dependancies that often make it impossible to use one built with Borland in conjuction with a perl built with VC++ (ie. AS).

    I've not really tied down quite why this is the case, I did spend some time trying to investigate it, but got kind of demoralised and gave up. I have built some modules with Borland that result in a dll that work fine with AS, but mostly not.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
    If I understand your problem, I can solve it! Of course, the same can be said for you.

      Thanks for the advise. :-)

      I will try to look for a visual C compiler to compile the DLL with. Making it to compile with borland was a bit hard.

        Unfortunately, that tends to be the case, which is a crying shame. It rankles with me that the only way to use Perl on the Win32 platform forces so many people into either purchasing VC++ (and throwing good money into the MS coffers!) or obtaining it through "dubious means", when there are several free compilers available.

        There is the Cygwin route of course, but that adds yet another unnecessary and complicating layer into the mix.

        Unless we could build up a head of steam behind one, free, native Win32 compiler, the situation of dependancy upon VC++ will continue:(


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
        If I understand your problem, I can solve it! Of course, the same can be said for you.

Re: Compiling DBD::Sybase with Borland C++ 5.5
by tachyon (Chancellor) on Oct 01, 2003 at 13:31 UTC

    crazyinsomniac plays with Sybase and has the compiled driver in his PPM repository. If that is not what you need he could be a good person to ask....

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      Hi Tachyon, yes I have ppm installed his compiled DBD::Sybase from his PPM repository. But that version was giving the same error messages too.

        AS build with cl.exe (part of M$ Visual C++ these days)and things work so much easier if you go with the flow. If you are/know a student you can get it for next to nothing. Anyway, I can't compile the driver for you as you need the Sybase headers on the system to do it and I don't have them. Hopefully someone will have.

        cheers

        tachyon

        s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

        Oh really? Did you do like install_sybase says? I suggest you do ;)

        MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
        I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
        ** The third rule of perl club is a statement of fact: pod is sexy.

Re: Compiling DBD::Sybase with Borland C++ 5.5
by jdtoronto (Prior) on Oct 01, 2003 at 14:24 UTC
    Just like BrowserUK says, you proably need to build the module in exactly the same environment as your Perl was built.

    But, whatever the case, a very good place to ask these questions is on the dbi-users@perl.org mailing list. You can find details at http://dbi.perl.org

    jdtoronto