On Tuesday, 14 October 2014 at 04:46:19 UTC, Sergey wrote:
I try to do in this:
D version: http://pastebin.com/7tGyytDh
Tds file: http://pastebin.com/JCA8XQH0
C version: http://pastebin.com/FWJM4B6X
First I checked the C version.
When I did this:
$ gcc -o connect_mssql connect_mssql.c
I got these errors:
/tmp/ccmW3YHR.o: In function `main':
connect_mssql.c:(.text+0x18): undefined reference to `dbinit'
connect_mssql.c:(.text+0x50): undefined reference to `dblogin'
connect_mssql.c:(.text+0xaf): undefined reference to
`dbsetlname'
connect_mssql.c:(.text+0xce): undefined reference to
`dbsetlname'
connect_mssql.c:(.text+0xed): undefined reference to
`dbsetlname'
connect_mssql.c:(.text+0x12d): undefined reference to
`dbsetlname'
connect_mssql.c:(.text+0x14c): undefined reference to
`tdsdbopen'
connect_mssql.c:(.text+0x19b): undefined reference to `dbuse'
connect_mssql.c:(.text+0x1dd): undefined reference to
`dbloginfree'
connect_mssql.c:(.text+0x1f4): undefined reference to `dbcmd'
connect_mssql.c:(.text+0x203): undefined reference to
`dbsqlexec'
connect_mssql.c:(.text+0x245): undefined reference to
`dbresults'
connect_mssql.c:(.text+0x277): undefined reference to `dbbind'
connect_mssql.c:(.text+0x2a9): undefined reference to `dbbind'
connect_mssql.c:(.text+0x2e4): undefined reference to
`dbnextrow'
connect_mssql.c:(.text+0x2f8): undefined reference to
`dbfreebuf'
connect_mssql.c:(.text+0x307): undefined reference to `dbclose'
connect_mssql.c:(.text+0x30c): undefined reference to `dbexit'
collect2: error: ld returned 1 exit status
And then I added this: "-l sybdb" and it works.
$ gcc -o connect_mssql connect_mssql.c -l sybdb
$ ./connect_mssql
(I got some data from sql server)
Then I tried to do it on D:
$ dmd test_tds_connect.d
And I received similar errors:
test_tds_connect.o: In function `_Dmain':
test_tds_connect.d:(.text._Dmain+0x64): undefined reference to
`dbinit'
test_tds_connect.d:(.text._Dmain+0x88): undefined reference to
`dblogin'
test_tds_connect.d:(.text._Dmain+0xc4): undefined reference to
`dbsetluser'
test_tds_connect.d:(.text._Dmain+0xdb): undefined reference to
`dbsetlpwd'
test_tds_connect.d:(.text._Dmain+0xf2): undefined reference to
`dbsetlapp'
test_tds_connect.d:(.text._Dmain+0x12c): undefined reference to
`dbsetlhost'
test_tds_connect.d:(.text._Dmain+0x140): undefined reference to
`dbopen'
test_tds_connect.d:(.text._Dmain+0x18c): undefined reference to
`dbuse'
test_tds_connect.d:(.text._Dmain+0x1df): undefined reference to
`dbloginfree'
test_tds_connect.d:(.text._Dmain+0x1f0): undefined reference to
`dbcmd'
test_tds_connect.d:(.text._Dmain+0x1fe): undefined reference to
`dbsqlexec'
test_tds_connect.d:(.text._Dmain+0x22b): undefined reference to
`dbresults'
test_tds_connect.d:(.text._Dmain+0x243): undefined reference to
`dbbind'
test_tds_connect.d:(.text._Dmain+0x25b): undefined reference to
`dbbind'
test_tds_connect.d:(.text._Dmain+0x273): undefined reference to
`dbbind'
test_tds_connect.d:(.text._Dmain+0x281): undefined reference to
`dbnextrow'
test_tds_connect.d:(.text._Dmain+0x2d4): undefined reference to
`dbfreebuf'
test_tds_connect.d:(.text._Dmain+0x2df): undefined reference to
`dbclose'
test_tds_connect.d:(.text._Dmain+0x2e4): undefined reference to
`dbexit'
collect2: error: ld returned 1 exit status
--- errorlevel 1
I need to add sybdb when building on D?
How to do it?
Thanks in advance.
Wrong, I need to have:
$ dmd test_tds_connect.d tds.d
test_tds_connect.o: In function `_Dmain':
tds.d:(.text._Dmain+0x64): undefined reference to `dbinit'
tds.d:(.text._Dmain+0x88): undefined reference to `dblogin'
tds.d:(.text._Dmain+0x140): undefined reference to `dbopen'
tds.d:(.text._Dmain+0x18c): undefined reference to `dbuse'
tds.d:(.text._Dmain+0x1df): undefined reference to `dbloginfree'
tds.d:(.text._Dmain+0x1f0): undefined reference to `dbcmd'
tds.d:(.text._Dmain+0x1fe): undefined reference to `dbsqlexec'
tds.d:(.text._Dmain+0x22b): undefined reference to `dbresults'
tds.d:(.text._Dmain+0x243): undefined reference to `dbbind'
tds.d:(.text._Dmain+0x25b): undefined reference to `dbbind'
tds.d:(.text._Dmain+0x273): undefined reference to `dbbind'
tds.d:(.text._Dmain+0x281): undefined reference to `dbnextrow'
tds.d:(.text._Dmain+0x2d4): undefined reference to `dbfreebuf'
tds.d:(.text._Dmain+0x2df): undefined reference to `dbclose'
tds.d:(.text._Dmain+0x2e4): undefined reference to `dbexit'
test_tds_connect.o: In function `dbsetluser':
tds.d:(.text.dbsetluser+0x18): undefined reference to `dbsetlname'
test_tds_connect.o: In function `dbsetlpwd':
tds.d:(.text.dbsetlpwd+0x18): undefined reference to `dbsetlname'
test_tds_connect.o: In function `dbsetlapp':
tds.d:(.text.dbsetlapp+0x18): undefined reference to `dbsetlname'
test_tds_connect.o: In function `dbsetlhost':
tds.d:(.text.dbsetlhost+0x18): undefined reference to `dbsetlname'
collect2: error: ld returned 1 exit status
--- errorlevel 1