http://qs321.pair.com?node_id=649923


in reply to Re^2: DBD::Sybase with Sybase 15.0
in thread DBD::Sybase with Sybase 15.0

You need to add -lsybblk.lib to that $lib_string line.

Michael

Replies are listed 'Best First'.
Re4: DBD::Sybase with Sybase 15.0
by vcdmb (Initiate) on Nov 19, 2007 at 18:12 UTC
    So close, yet so far ..... I actually get the program to compile, just doesn't work.
    Can't load 'C:/Perl/site/lib/auto/DBD/Sybase/Sybase.dll' for module DB +D::Sybase: load_file:A dynamic link library (DLL) initialization routine failed +at /<C:\Pr
    Here's where I'm at: 1) Make the library changes as noted above (thank you, that was a duh moment on my part) 2) ran nmake:
    bdimp.c(5637) : warning C4996: 'strncpy' was declared deprecated C:\msvs8\VC\INCLUDE\string.h(156) : see declaration of 'strncp +y' Message: 'This function or variable may be unsafe. Consider us +ing strncp y_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See + online he lp for details.' Running Mkbootstrap for DBD::Sybase () C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 Sybase.b +s C:\Perl\bin\perl.exe -MExtUtils::Mksymlists -e "Mksymlists('N +AME'=>\"DB D::Sybase\", 'DLBASE' => 'Sybase', 'DL_FUNCS' => { }, 'FUNCLIST' => [ +], 'IMPORT S' => { }, 'DL_VARS' => []);" link -out:blib\arch\auto\DBD\Sybase\Sybase.dll -LC:\sybase70/O +CS-15_0/li b -dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"C:\Perl\li +b\CORE" - machine:x86 Sybase.obj dbdimp.obj C:\Perl\lib\CORE\perl58.lib C:\sy +base70\OCS -15_0\lib\libsybct.lib C:\sybase70\OCS-15_0\lib\libsybcs.lib C:\sybase +70\OCS-15_ 0\lib\libsybblk.lib C:\msvs8\VC\LIB\oldnames.lib C:\msvs8\VC\LIB\kerne +l32.lib C: \mssdk\Lib\user32.lib C:\mssdk\Lib\gdi32.lib C:\mssdk\Lib\winspool.lib + C:\mssdk\ Lib\comdlg32.lib C:\mssdk\Lib\advapi32.lib C:\mssdk\Lib\shell32.lib C: +\mssdk\Lib \ole32.lib C:\mssdk\Lib\oleaut32.lib C:\mssdk\Lib\netapi32.lib C:\mssd +k\Lib\uuid .lib C:\mssdk\Lib\ws2_32.lib C:\mssdk\Lib\mpr.lib C:\mssdk\Lib\winmm.l +ib C:\mssd k\Lib\version.lib C:\mssdk\Lib\odbc32.lib C:\mssdk\Lib\odbccp32.lib C: +\msvs8\VC\ LIB\msvcrt.lib -def:Sybase.def LINK : warning LNK4044: unrecognized option '/LC:\sybase70/OCS-15_0/li +b'; ignore d Creating library blib\arch\auto\DBD\Sybase\Sybase.lib and object bl +ib\arch\auto\DBD\Sybase\Sybase.exp C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 755 blib\arc +h\auto\DBD\Sybase\Sybase.dll C:\Perl\bin\perl.exe -MExtUtils::Command -e cp Sybase.bs blib\ +arch\auto\DBD\Sybase\Sybase.bs C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 blib\arc +h\auto\DBD\Sybase\Sybase.bs
    The only error I really see is the unrecognized option '/LC:....' error. In the makefile, this is what I see:
    LDDLFLAGS = -LC:\sybase70/OCS-15_0/lib -dll -nologo -nodefaultlib -deb +ug -opt:ref,icf -libpath:"C:\Perl\lib\CORE" -machine:x86
      Unfortunately I don't know much about Windows, and even less about the way MSVC works (specifying libraries, etc).

      Stupid question time.... is the SYBASE env. variable set correctly when you try to run your test ?

      Michael

        I know zip about MSVC, unfortunately. But that was the tips I found for compiling this on Windows. Yes, SYBASE is set along with

        SYBASE=C:\sybase70 SYBASE_JRE=C:\sybase70\Shared\Sun\jre142 SYBASE_OCS=OCS-15_0 SYBASE_UA=C:\sybase70\ua INCLUDE=C:\sybase70\OCS-15_0\include LIB=C:\sybase70\OCS-15_0\lib

        Edit: g0n - code tags

        Hi,

        It took me some seven days to compile and successfully link DBI::Sybase1.08 against Sybase OCS15 on Mingw / Windows Vista. I would surely share my trick, it is really difficult to link sybase libraries using Mingw. If I link on VC8, it is linked to msvcr80.dll. It fails to load because of windows side by side dll installation.

        So I tried to link using free Mingw, it links with msvcrt.dll. Downloaded mingw, binutils, unix utils (unixutils.sourceforge.net) and nmake from VC8\bin.


        I followed the articles at:
        http://mingw.org/mingwfaq.shtml#faq-msvcdll
        http://sapdb.2scale.net/maxdb-wiki/MS_C++_Toolkit
        http://www.geocities.com/yongweiwu/stdcall.htm

        And created my own libraries out of %sybase%\dll\*

        Step1: Create the following sed file, call it exp.sed

        / \t*ordinal hint/,/^ \t*Summary/{
        /^ \t\+0-9\+/{
        s/^ \t\+0-9\+ \t\+0-9A-Fa-f\+ \t\+0-9A-Fa-f\+ \t\+\(.*\)/\1/p
        }
        }


        Step2: Create following batch file, call it genlib.bat
        echo LIBRARY %1.dll > %1.def
        echo EXPORTS >> %1.def
        link -dump -exports %1.dll | sed -nf c:\temp\DBD-Sybase-1.08\exports.sed >> %1.def
        dlltool -U -d %1.def -l %1.a


        Step3: go to %sybase%\dll and run the following loop (type it on dos prompt and press enter)

        for /f %i in ('dir /b *.dll') do a %~ni & move /Y %~ni.a ..\lib\ & del %~ni.def
        Step4:
        Go to DBD-Sybase-1.08 directory, edit makefile.pl, change libct to libsybct.a etc .. and run nmake it compiles and links correctly, but all the tests fail!!!

        --------------------------------------------------------
        ERROR:
        # Tried to use 'DBD::Sybase'.
        # Error: Can't load 'C:\temp\DBD-Sybase-1.08\blib\arch/auto/DBD/Sybase/Sybase.dll' for module DBD::Sybase: load_file:The specified procedure could not be found at C:/Perl/lib/DynaLoader.pm line 201.
        --------------------------------------------------------

        So I tried again to debug:
        Went to "DBD-Sybase-1.08\blib\arch\auto\DBD\Sybase"
        and issued "link -dump -exports Sybase.dll"

        The following dump clearly shows there aren't any methods exported. It seems the __declspec(export) is not evaluated by some preprocessor macro during compilation.


        Dump of file Sybase.dll File Type: DLL Section contains the following exports for dll.exp.dll 00000000 characteristics 47FAA9E4 time date stamp Tue Apr 08 00:10:28 2008 0.00 version 1 ordinal base 2 number of functions 2 number of names ordinal hint RVA name 2 0 00006130 _boot_DBD__Sybase 1 1 00006130 boot_DBD__Sybase Summary 1000 .bss 1000 .data 1000 .edata 2000 .idata 5000 .rdata 1000 .reloc 16000 .text


        Michael could you please help me, here?


        Thanks,
        Sanjit