[freetds] Success in compiling FreeTDS.dll + dblib.dll using Dev-C++/Mingw.. this is how

Gal Rubinstein galrub at gmail.com
Sun Mar 15 05:33:01 EDT 2009


Sorry... my mistake, I used odbc files again, fixed. still need a def file
for export, did that too... thanks anyway

On Sun, Mar 15, 2009 at 11:12 AM, Gal Rubinstein <galrub at gmail.com> wrote:

> update, I changed the linker params: and now:
>
> [trace]
>
> make.exe -f "C:\Gal\tmp\freetds-0.82\src\dblib\Makefile.win" all
> dllwrap.exe --output-def libdblib.def --implib libdblib.a xact.o bcp.o
> dblib.o dbopen.o dbutil.o rpc.o ../tds/write.o ../tds/challenge.o
> ../tds/config.o ../tds/convert.o ../tds/data.o ../tds/des.o ../tds/getmac.o
> ../tds/gssapi.o ../tds/iconv.o ../tds/locale.o ../tds/log.o ../tds/login.o
> ../tds/md4.o ../tds/md5.o ../tds/mem.o ../tds/net.o ../tds/numeric.o
> ../tds/query.o ../tds/read.o ../tds/tds_checks.o ../tds/tdsstring.o
> ../tds/threadsafe.o ../tds/token.o ../tds/util.o ../tds/vstrbuild.o
> ../replacements/vasprintf.o ../replacements/asprintf.o
> ../replacements/atoll.o ../replacements/basename.o
> ../replacements/gettimeofday.o ../replacements/iconv.o
> ../replacements/readpassphrase.o ../replacements/strlcat.o
> ../replacements/strlcpy.o ../replacements/strtok_r.o ../../win32/winsetup.o
> ../../win32/initnet.o ../../win32/winlogin.o  -L"C:/MinGW/lib"
> -L"C:/Dev-Cpp/lib" -lws2_32 -lkernel32 -luser32 -lgdi32 -lwinspool
> -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -s
> -Wl,--enable-stdcall-fixup -Wl,--export-all-symbols   -o dblib.dll
>
> ../../win32/winsetup.o:winsetup.c:(.text+0xc4): undefined reference to
> `SQLWritePrivateProfileString at 16'
> ../../win32/winsetup.o:winsetup.c:(.text+0xfb): undefined reference to
> `SQLWritePrivateProfileString at 16'
> ../../win32/winsetup.o:winsetup.c:(.text+0x126): undefined reference to
> `SQLWritePrivateProfileString at 16'
> ../../win32/winsetup.o:winsetup.c:(.text+0x16f): undefined reference to
> `SQLWritePrivateProfileString at 16'
> ../../win32/winsetup.o:winsetup.c:(.text+0x1c5): undefined reference to
> `SQLWritePrivateProfileString at 16'
> ../../win32/winsetup.o:winsetup.c:(.text+0x215): more undefined references
> to `SQLWritePrivateProfileString at 16' follow
> ../../win32/winsetup.o:winsetup.c:(.text+0x290): undefined reference to
> `SQLValidDSN at 4'
> ../../win32/winsetup.o:winsetup.c:(.text+0x81b): undefined reference to
> `odbc_parse_connect_string'
> ../../win32/winsetup.o:winsetup.c:(.text+0x8a9): undefined reference to
> `SQLRemoveDSNFromIni at 4'
> ../../win32/winsetup.o:winsetup.c:(.text+0x92b): undefined reference to
> `SQLPostInstallerError at 8'
> ../../win32/winsetup.o:winsetup.c:(.text+0x95b): undefined reference to
> `SQLWriteDSNToIni at 8'
>
> ../../win32/winsetup.o:winsetup.c:(.text+0x991): undefined reference to
> `SQLRemoveDSNFromIni at 4'
> collect2: ld returned 1 exit status
>
> dllwrap.exe: no export definition file provided.
> Creating one, but that may not be what you want
> dllwrap.exe: gcc exited with status 1
>
> make.exe: *** [dblib.dll] Error 1
>
> [/trace]
>
>
>
>
> On Sun, Mar 15, 2009 at 8:24 AM, Gal Rubinstein <galrub at gmail.com> wrote:
>
>> So that's why the .def file didn't contain all this symbols, right?
>>
>> So, I should try compiling dblib with libTDS.... ok, I get this...
>>
>> [trace]
>> ./tds/config.o:config.c:(.text+0x9fd): undefined reference to `inet_addr at 4
>> '
>> ../tds/config.o:config.c:(.text+0x105a): undefined reference to `ntohs at 4'
>> ../tds/mem.o:mem.c:(.text+0x144e): undefined reference to `gethostname at 8'
>> ../tds/net.o:net.c:(.text+0x1b): undefined reference to `WSAStartup at 8'
>> ../tds/net.o:net.c:(.text+0x63): undefined reference to `closesocket at 4'
>> ../tds/net.o:net.c:(.text+0x95): undefined reference to `WSAGetLastError at 0
>> '
>> ../tds/net.o:net.c:(.text+0x256): undefined reference to `select at 20'
>> ../tds/net.o:net.c:(.text+0x383): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x393): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x3a2): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x407): undefined reference to `inet_addr at 4'
>> ../tds/net.o:net.c:(.text+0x426): undefined reference to `htons at 4'
>> ../tds/net.o:net.c:(.text+0x438): undefined reference to `ntohs at 4'
>> ../tds/net.o:net.c:(.text+0x4aa): undefined reference to `socket at 12'
>> ../tds/net.o:net.c:(.text+0x4e9): undefined reference to `setsockopt at 20'
>> ../tds/net.o:net.c:(.text+0x51c): undefined reference to `setsockopt at 20'
>> ../tds/net.o:net.c:(.text+0x54b): undefined reference to `ioctlsocket at 12'
>> ../tds/net.o:net.c:(.text+0x570): undefined reference to `connect at 12'
>> ../tds/net.o:net.c:(.text+0x5ce): undefined reference to `getsockopt at 20'
>> ../tds/net.o:net.c:(.text+0x67c): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x697): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x6c6): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x6de): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x785): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x81a): undefined reference to `recv at 16'
>> ../tds/net.o:net.c:(.text+0x863): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x8aa): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x8b4): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x8da): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x8ed): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0xbc8): undefined reference to `send at 16'
>> ../tds/net.o:net.c:(.text+0xc31): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0xc8b): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0xccd): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0xd03): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0xd16): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0xd84): undefined reference to `inet_addr at 4'
>> ../tds/net.o:net.c:(.text+0xda3): undefined reference to `htons at 4'
>> ../tds/net.o:net.c:(.text+0xdc5): undefined reference to `socket at 12'
>> ../tds/net.o:net.c:(.text+0xdf9): undefined reference to `ioctlsocket at 12'
>> ../tds/net.o:net.c:(.text+0xead): undefined reference to `sendto at 24'
>> ../tds/net.o:net.c:(.text+0xf02): undefined reference to `select at 20'
>> ../tds/net.o:net.c:(.text+0xf3a): undefined reference to `recv at 16'
>> ../tds/net.o:net.c:(.text+0xf77): undefined reference to `closesocket at 4'
>> ../tds/net.o:net.c:(.text+0xfe1): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x1005): undefined reference to `closesocket at 4'
>> ../tds/net.o:net.c:(.text+0x103e): undefined reference to
>> `WSAGetLastError at 0'
>> ../tds/net.o:net.c:(.text+0x35): undefined reference to `WSACleanup at 0'
>> ../tds/threadsafe.o:threadsafe.c:(.text+0x7d): undefined reference to
>> `gethostbyname at 4'
>> ../tds/threadsafe.o:threadsafe.c:(.text+0xa1): undefined reference to
>> `inet_ntoa at 4'
>> ../tds/threadsafe.o:threadsafe.c:(.text+0xe4): undefined reference to
>> `getservbyname at 8'
>> ../../win32/winsetup.o:winsetup.c:(.text+0xc4): undefined reference to
>> `SQLWritePrivateProfileString at 16'
>> ../../win32/winsetup.o:winsetup.c:(.text+0xfb): undefined reference to
>> `SQLWritePrivateProfileString at 16'
>> ../../win32/winsetup.o:winsetup.c:(.text+0x126): undefined reference to
>> `SQLWritePrivateProfileString at 16'
>> ../../win32/winsetup.o:winsetup.c:(.text+0x16f): undefined reference to
>> `SQLWritePrivateProfileString at 16'
>> ../../win32/winsetup.o:winsetup.c:(.text+0x1c5): undefined reference to
>> `SQLWritePrivateProfileString at 16'
>> ../../win32/winsetup.o:winsetup.c:(.text+0x215): more undefined references
>> to `SQLWritePrivateProfileString at 16' follow
>> ../../win32/winsetup.o:winsetup.c:(.text+0x290): undefined reference to
>> `SQLValidDSN at 4'
>> ../../win32/winsetup.o:winsetup.c:(.text+0x81b): undefined reference to
>> `odbc_parse_connect_string'
>> ../../win32/winsetup.o:winsetup.c:(.text+0x8a9): undefined reference to
>> `SQLRemoveDSNFromIni at 4'
>> ../../win32/winsetup.o:winsetup.c:(.text+0x92b): undefined reference to
>> `SQLPostInstallerError at 8'
>> ../../win32/winsetup.o:winsetup.c:(.text+0x95b): undefined reference to
>> `SQLWriteDSNToIni at 8'
>> ../../win32/winsetup.o:winsetup.c:(.text+0x991): undefined reference to
>> `SQLRemoveDSNFromIni at 4'
>> ../../win32/initnet.o:initnet.c:(.text+0x34): undefined reference to
>> `WSAStartup at 8'
>>
>> [/trace]
>>
>> any ideas?
>>
>>
>> On Sat, Mar 14, 2009 at 9:47 PM, Frediano Ziglio <freddy77 at gmail.com>wrote:
>>
>>> 2009/3/12 Gal Rubinstein <galrub at gmail.com>:
>>> > just wanted you all to know that I was able to overcome the noobie
>>> challenge
>>> > of creating dblib.dll
>>> > using Dev-C++, here is how:
>>> >
>>> >
>>> >   1.  the FreeTDS comes with a dev-c++ project  that uses the
>>> >   \freetds\win32\FreeTDS.def file for export, but the file is missing
>>> more
>>> >   then a few symbols, such as: tdsdump_log, tds_strlcpy, tds_set_bulk,
>>> >   vasprintf, etc. so I added them and rebuilded... the only thing that
>>> is
>>> >   bothering is that the are alot of warning on compile time, indicating
>>> >   redfining of vars...
>>> >   2. created a new Dev-C++ DLL project, mamed dblib..
>>> >   3. added to include folders: 'freetds\include' and 'freetds\win32\'/
>>> >   4. added to library path: 'freetds\win32\dev-cpp'.
>>> >   5. on c/c++ compiler varibales added definition:
>>> >   '_FREETDS_LIBRARY_SOURCE' ('-D_FREETDS_LIBRARY_SOURCE).
>>> >   6. on linker varibale added -lFreeTDS and chaged
>>> >   '--no-export-all-symbols' to '--export-all-symbols'.
>>>
>>> The problem here is that your project should include libTDS files, not
>>> link to FreeTDS.dll which is an ODBC driver and contains code you
>>> don't need.
>>>
>>> >   7. builded, got the dll, but again, bothring warning of var getting
>>> >   redefine.
>>> >
>>> > thats it,
>>> > any ideas on these warnings? are the critical?
>>> >
>>> > thanks
>>>
>>> I don't know... try to post them...
>>>
>>> freddy77
>>> _______________________________________________
>>> FreeTDS mailing list
>>> FreeTDS at lists.ibiblio.org
>>> http://lists.ibiblio.org/mailman/listinfo/freetds
>>>
>>
>>
>>
>> --
>>
>>
>


-- 
Yours,
Gal
galrub at gmail.com



More information about the FreeTDS mailing list