Re: HOWTO compille FreeTDS under Windows
LacaK <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
Hi James,
thanks for reply. Let me explain in details my point of view ;-)
> Ask yourself this: how does one create a DLL from nothing? Search the Web
> for examples/tutorials with "Win32 dll C". In short, open the
> flavor-of-the-day IDE, choose something like "create a DLL project" and
> pretty soon, splat, you'll have boilerplate DLL code. Compile. Good.
>
I am coming from Delphi/FreePascal world, where things are bit different.
(I use dblib.dll in FreePascal db access class, which uses db-lib api to
comunicate with MS SQL Server)
> Add dblib.lib to your project, and a .DEF file naming the dblib functions
> (easily extracted from doc/api_status.txt). Compile again. Voila! A
> DLL.
>
Yes, DEF file is one missing things. I attach my DEF file. Do you think,
that this file (dblib_w.def) can be added into FreeTDS sources - Win32
directory ?
(where already FreeTDS_w.def is) I hope, that it will be useful also for
others who needs build dblib.dll.
Second missing things are linker dependencies, which must be set to
compile (+ws2_32.lib)
I also attach modified Visual Studio project files, which adds dblib_dll
(dynamic library) beside existing dblib (static library).
May be, that it is not perfect solution, but it is attempt to make
building more user friendly.
If it is not acceptable for you, then we can write somewhere HOWTO text
file (it will be very useful for new users):
How to compile FreeTDS under MS Visual Studio:
...
1. Change in project properties
General
Configuration type: Dynamic library (instead of Static library)
Linker
Input
Add dependencies: ws2_32.lib
Module definition: ..\dblib.def
> Supporting the Windows development environment is a bit of a nuisance --
> no offence intended! -- for a free software project because the setup is
> so variable. I wrote the FreeTDS NMakefile specifically to compile db-lib
> regardless of the version of Visual Studio anyone might happen to use. I
> don't know now portable it really is, or if anyone uses it, but at least
> if problems are found it can be patched. A .dsw or .sln or .vcproj file
> cannot be patched, and likely as not won't work anyway. Just the other
> day I tried to compile APL for Windows and VS complained the project file
> was for a newer version. No simple remedy there.
>
Do you have any prefered compiler for Windows ? If yes, then project
files can be optimized for that compiler (resp. tutorial can be written)
Really I am not C/C++ expert, so I only share my experiences with you.
I leave it up to you. If you can make things to be easyier for non C/C++
programers then it will be welcome!
L.
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
dblib_w.def
(text/plain, 764 B)
EXPORTS dbbind dbcancel dbcanquery dbclose dbclrbuf dbcmd dbcmdrow dbtablecolinfo dbcolinfo dbcollen dbcolname dbcolsource dbcoltype dbcoltypeinfo dbcolutype dbconvert dbcount dbcurcmd dbcurrow dbdata dbdatecmp dbdatecrack dbdatlen dbdead dberrhandle dbexit dbfcmd dbfirstrow dbfreebuf dbinit dbisavail dbiscount dbisopt dblastrow dblogin dbloginfree dbmorecmds dbmoretext dbmsghandle dbname dbnextrow dbnullbind dbnumalts dbnumcols dbnumcompute dbnumrets tdsdbopen dbopen dbprtype dbresults dbrows dbrowtype dbsetlname dbsetlversion dbsetlogintime dbsetopt dbsetrow dbsettime dbsetuserdata dbsetversion dbservcharset dbsqlexec dbsqlok dbsqlsend dbstrlen dbtds dbvarylen dbuse dbwillconvert
dblib_dll.dsp
(text/plain, 3.9 KB)
# Microsoft Developer Studio Project File - Name="dblib_dll" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=dblib_dll - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "dblib.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "dblib.mak" CFG="dblib_dll - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "dblib_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "dblib_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "dblib_dll - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "db_Release" # PROP BASE Intermediate_Dir "db_Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "db_Release" # PROP Intermediate_Dir "db_Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "../../include" /I "../../src" /D "HAVE_CONFIG_H" /D "UNIXODBC" /D "_FREETDS_LIBRARY_SOURCE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FREETDS_EXPORTS" /D "HAVE_SQLGETPRIVATEPROFILESTRING" /FR /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /dll /machine:I386 # ADD LINK32 ws2_32.lib /nologo /dll /machine:I386 !ELSEIF "$(CFG)" == "dblib_dll - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "db_Debug" # PROP BASE Intermediate_Dir "db_Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "db_Debug" # PROP Intermediate_Dir "db_Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".." /I "../../include" /D "HAVE_CONFIG_H" /D "UNIXODBC" /D "_FREETDS_LIBRARY_SOURCE" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FREETDS_EXPORTS" /D "HAVE_SQLGETPRIVATEPROFILESTRING" /FR /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /dll /machine:I386 # ADD LINK32 ws2_32.lib /nologo /dll /machine:I386 !ENDIF # Begin Target # Name "dblib_dll - Win32 Release" # Name "dblib_dll - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\..\src\dblib\dblib.c # End Source File # Begin Source File SOURCE=..\..\src\dblib\dbopen.c # End Source File # Begin Source File SOURCE=..\..\src\dblib\dbutil.c # End Source File # Begin Source File SOURCE=..\..\src\dblib\rpc.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=..\..\src\dblib\error_table.h # End Source File # Begin Source File SOURCE=..\..\include\sybdb.h # End Source File # Begin Source File SOURCE=..\..\include\syberror.h # End Source File # Begin Source File SOURCE=..\..\include\sybfront.h # End Source File # Begin Source File SOURCE=..\dblib.def # End Source File # End Group # End Target # End Project
FreeTDS.dsw
(text/plain, 1.5 KB)
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "FreeTDS"=".\FreeTDS.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name libTDS
End Project Dependency
}}}
###############################################################################
Project: "dblib"=".\dblib.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name libTDS
End Project Dependency
}}}
###############################################################################
Project: "dblib_dll"=".\dblib_dll.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name libTDS
End Project Dependency
}}}
###############################################################################
Project: "libTDS"=".\libTDS.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "libct"=".\libct.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name libTDS
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################