[fpc-pascal] SqlDB and MS SQL Server support

Marco van de Voort marcov at stack.nl
Wed Aug 13 18:01:45 CEST 2014

In our previous episode, Sven Barth said:
> >
> > Well, and SEH should be on by default for 32-bit I guess?
> Definitely! :)
> > Anyway the typelibs seems to mostly work:
> Do the generated units also compile?

Yes, the only problem is that they are not OLEDB as Delphi has the unit.
Probably more ADO like.

It seems that oledb itself has no typelib, at least I can't find it (scanned all files in 
common\ado and common\ole db), and others hint on it too
( http://www.gocher.me/ADO-Free-Pascal )

So manual conversion of the (huge) SDK header is the only way out it seems.

Final batch file:

del *.pas *.lpk *.ppu *.o

set inputdir="%CommonProgramFiles(x86)%\system\ado" 
set lazdir=d:\repo\lazarus
set outputdir=c:\tlbs

echo from %inputdir% to %outputdir%

set flags=-a -d "%outputdir%" -p
mkdir %outputdir%
cd /d %inputdir%
rem  for /r %%i in (*.tlb) do importtl %flags% "%%i"

set inputdir="%CommonProgramFiles(x86)%\system\ole db"

cd /d %inputdir%
for /r %%i in (*.dll) do importtl %flags% "%%i"

cd %outputdir%

rem assumes lazarus compiled and activex component installed, flags on one

# rem on one line
set flags=-Fu%lazdir%\components\activex\lib\i386-win32 

for /r %%i in (*_tlb.pas) do fpc %flags% "%%i"

More information about the fpc-pascal mailing list