Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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

In reply to Re^2: Re4: DBD::Sybase with Sybase 15.0 by goga
in thread DBD::Sybase with Sybase 15.0 by vcdmb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (4)
    As of 2020-11-30 07:32 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?