www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problems compiling sqlite-d

reply Nestor <nestorperez2016 yopmail.com> writes:
Hi,

I was trying to use https://github.com/UplinkCoder/sqlite-d

Unfortunately even something as simple as this doesn´t compile 
(at least on Windows):

import std.stdio, sqlited;

void main(string[] args) {
   string filename = (args.length == 2 ? args[1] : "data.db");
   Database db = Database(filename);
}

See the error:
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
z1_app.obj(z1_app)
  Error 42: Symbol Undefined _D7sqlited8Database6__initZ
z1_app.obj(z1_app)
  Error 42: Symbol Undefined 
_D7sqlited8Database6__ctorMFNcAyabZS7sqlited8Database
Error: linker exited with status 107814472

Is there any other native D implementation of sqlite reader?
Jan 27
next sibling parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Friday, 27 January 2017 at 12:01:30 UTC, Nestor wrote:
 Hi,

 I was trying to use https://github.com/UplinkCoder/sqlite-d

 Unfortunately even something as simple as this doesn´t compile 
 (at least on Windows):

 import std.stdio, sqlited;

 void main(string[] args) {
   string filename = (args.length == 2 ? args[1] : "data.db");
   Database db = Database(filename);
 }

 See the error:
 OPTLINK (R) for Win32  Release 8.00.17
 Copyright (C) Digital Mars 1989-2013  All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 z1_app.obj(z1_app)
  Error 42: Symbol Undefined _D7sqlited8Database6__initZ
 z1_app.obj(z1_app)
  Error 42: Symbol Undefined 
 _D7sqlited8Database6__ctorMFNcAyabZS7sqlited8Database
 Error: linker exited with status 107814472

 Is there any other native D implementation of sqlite reader?
I take it you build without dub ? Have you specified source/sqlite.d on your compile commandline ?
Jan 27
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Friday, 27 January 2017 at 12:04:06 UTC, Stefan Koch wrote:
 I take it you build without dub ?
 Have you specified source/sqlite.d on your compile commandline ?
That was supposed to say. sqlite-d/source/sqlited.d Please feel free to post here or contact me directly regarding the usage of sqlite-d.
Jan 27
parent reply Nestor <nestorperez2016 yopmail.com> writes:
On Friday, 27 January 2017 at 12:06:33 UTC, Stefan Koch wrote:
 On Friday, 27 January 2017 at 12:04:06 UTC, Stefan Koch wrote:
 I take it you build without dub ?
 Have you specified source/sqlite.d on your compile commandline 
 ?
That was supposed to say. sqlite-d/source/sqlited.d Please feel free to post here or contact me directly regarding the usage of sqlite-d.
Yes I was building withoug dub. What I did was simply: copy data.db to sqlite-d/source cd to sqlite-d/source copy api_user.d to z1_app.d modify z1_app.d (as shown before) compile z1_app without additional parameters. Shouldn't it work? This was with dmd v2.072.2 on Windows 7 SP1 x86-64
Jan 27
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Friday, 27 January 2017 at 12:21:29 UTC, Nestor wrote:
 On Friday, 27 January 2017 at 12:06:33 UTC, Stefan Koch wrote:
 On Friday, 27 January 2017 at 12:04:06 UTC, Stefan Koch wrote:
 I take it you build without dub ?
 Have you specified source/sqlite.d on your compile 
 commandline ?
That was supposed to say. sqlite-d/source/sqlited.d Please feel free to post here or contact me directly regarding the usage of sqlite-d.
Yes I was building withoug dub. What I did was simply: copy data.db to sqlite-d/source cd to sqlite-d/source copy api_user.d to z1_app.d modify z1_app.d (as shown before) compile z1_app without additional parameters. Shouldn't it work? This was with dmd v2.072.2 on Windows 7 SP1 x86-64
You have to compile the library with your app. or better yet use dub replace app.d with your app.d and run dub
Jan 27
parent reply Nestor <nestorperez2016 yopmail.com> writes:
On Friday, 27 January 2017 at 12:55:55 UTC, Stefan Koch wrote:
 You have to compile the library with your app.
 or better yet use dub
 replace app.d with your app.d and run dub
Thanks. It did compile using dub, though I had a couple of issues with dub, by the way. The first occured because I am using a proxy which allows me to use only the browser, so I downloaded the git repository to a directory and made tests there. However finally I moved the library to the proper location, which in Windows 7 is this: C:\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.0 Now, when I tried build your default app, it complained about the path: C:\>dub run sqlite-d Building package sqlite-d in C:\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.0\sqlite-d\ Performing "debug" build using dmd for x86. sqlite-d ~master: building configuration "application"... Linking... Running .\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.0\sqlite-d\sqlite-d.exe opening file views/test-2.3.sqlite std.file.FileException std\file.d(358): views/test-2.3.sqlite: El sistema no puede encontrar la ruta especificada. ---------------- 0x00425CC1 in trusted bool std.file.cenforce!(bool).cenforce(bool, const(char)[], const(wchar)*, immutable(char)[], uint) 0x004074C2 in safe void[] std.file.read!(immutable(char)[]).read(immutable(char)[], uint) at C:\dmd2\Windows\bin\..\..\src\phobos\std\file.d(228) 0x0040B947 in ref sqlited.Database sqlited.Database.__ctor(immutable(char)[], bool) 0x004022E9 in _Dmain at C:\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.0\sqlite-d\source\app.d(19) 0x0041CC8B in D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv 0x0041CC4F in void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() 0x0041CB50 in _d_run_main 0x00408644 in main at C:\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.0\sqlite-d\source\api_user.d(7) 0x0045BC45 in mainCRTStartup 0x754733CA in BaseThreadInitThunk 0x77309ED2 in RtlInitializeExceptionChain 0x77309EA5 in RtlInitializeExceptionChain Program exited with code 1 "El sistema no puede encontrar la ruta especificada" simply means "System can't find specified path" However, it compiles correctly if I run the command from C:\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.0\sqlite-d\ The second issue was perhaps related, I tried to make a new project using your library as a dependency: { "name": "sqlite-test", "authors": [ "Nestor Perez" ], "dependencies": { "sqlite-d": "~>0.1.0" }, "description": "Simple sqlite-d test application", "copyright": "Copyright (c) 2017, Nestor Perez", "license": "Boost" } However I get this error when i try to run dub: Fetching sqlite-d 0.1.0 (getting selected version)... Non-optional dependency sqlite-d of sqlite-test not found in dependency tree!?. I also tried copying sqlite-d directory to source/ of my project, but same thing happens. I confess I have no experience making new projects with dub, so if you can spare a little patience, what would be the proper way to use your library for a new project?
Jan 28
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Saturday, 28 January 2017 at 12:09:35 UTC, Nestor wrote:
 On Friday, 27 January 2017 at 12:55:55 UTC, Stefan Koch wrote:
 [...]
Thanks. It did compile using dub, though I had a couple of issues with dub, by the way. [...]
I think you have to remove the app.d that comes with sqlite-d file if you want to use it. Because that tries to open views/test-2.3.sqlite. Please try to read the source-code in app.d and in test.d that come with sqlite-d. If you have questions about that I am happy to answer them. Sqlite-d is a work in progress and I have not used it for an actual project. Currently I am busy with improving the ctfe engine. So I don't have to many resources should sqlite-d need improvements.
Jan 28
parent reply Nestor <nestorperez2016 yopmail.com> writes:
On Saturday, 28 January 2017 at 21:09:25 UTC, Stefan Koch wrote:
 On Saturday, 28 January 2017 at 12:09:35 UTC, Nestor wrote:
 On Friday, 27 January 2017 at 12:55:55 UTC, Stefan Koch wrote:
 [...]
Thanks. It did compile using dub, though I had a couple of issues with dub, by the way. [...]
I think you have to remove the app.d that comes with sqlite-d file if you want to use it. Because that tries to open views/test-2.3.sqlite. Please try to read the source-code in app.d and in test.d that come with sqlite-d. If you have questions about that I am happy to answer them. Sqlite-d is a work in progress and I have not used it for an actual project. Currently I am busy with improving the ctfe engine. So I don't have to many resources should sqlite-d need improvements.
Thanks for your willingness to help. Removing app.d from the library seems to make no difference. I just made an empty project as before (specifying your package as a dependency), like this: dub init sqlite-test Then I try to build using simply dub without parameters. However I get this message: Fetching sqlite-d 0.1.0 (getting selected version)... Non-optional dependency sqlite-d of sqlite-test not found in dependency tree!?. Am I missing a parameter or something?
Jan 28
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Sunday, 29 January 2017 at 01:47:44 UTC, Nestor wrote:
 On Saturday, 28 January 2017 at 21:09:25 UTC, Stefan Koch wrote:
 On Saturday, 28 January 2017 at 12:09:35 UTC, Nestor wrote:
 On Friday, 27 January 2017 at 12:55:55 UTC, Stefan Koch wrote:
 [...]
Thanks. It did compile using dub, though I had a couple of issues with dub, by the way. [...]
I think you have to remove the app.d that comes with sqlite-d file if you want to use it. Because that tries to open views/test-2.3.sqlite. Please try to read the source-code in app.d and in test.d that come with sqlite-d. If you have questions about that I am happy to answer them. Sqlite-d is a work in progress and I have not used it for an actual project. Currently I am busy with improving the ctfe engine. So I don't have to many resources should sqlite-d need improvements.
Thanks for your willingness to help. Removing app.d from the library seems to make no difference. I just made an empty project as before (specifying your package as a dependency), like this: dub init sqlite-test Then I try to build using simply dub without parameters. However I get this message: Fetching sqlite-d 0.1.0 (getting selected version)... Non-optional dependency sqlite-d of sqlite-test not found in dependency tree!?. Am I missing a parameter or something?
I just called dub fetch and see what the problem is. I am going to push an update to fix it. should be there in a minute
Jan 28
parent Nestor <nestorperez2016 yopmail.com> writes:
On Sunday, 29 January 2017 at 01:53:30 UTC, Stefan Koch wrote:
 On Sunday, 29 January 2017 at 01:47:44 UTC, Nestor wrote:
 On Saturday, 28 January 2017 at 21:09:25 UTC, Stefan Koch 
 wrote:
 On Saturday, 28 January 2017 at 12:09:35 UTC, Nestor wrote:
 On Friday, 27 January 2017 at 12:55:55 UTC, Stefan Koch 
 wrote:
 [...]
Thanks. It did compile using dub, though I had a couple of issues with dub, by the way. [...]
I think you have to remove the app.d that comes with sqlite-d file if you want to use it. Because that tries to open views/test-2.3.sqlite. Please try to read the source-code in app.d and in test.d that come with sqlite-d. If you have questions about that I am happy to answer them. Sqlite-d is a work in progress and I have not used it for an actual project. Currently I am busy with improving the ctfe engine. So I don't have to many resources should sqlite-d need improvements.
Thanks for your willingness to help. Removing app.d from the library seems to make no difference. I just made an empty project as before (specifying your package as a dependency), like this: dub init sqlite-test Then I try to build using simply dub without parameters. However I get this message: Fetching sqlite-d 0.1.0 (getting selected version)... Non-optional dependency sqlite-d of sqlite-test not found in dependency tree!?. Am I missing a parameter or something?
I just called dub fetch and see what the problem is. I am going to push an update to fix it. should be there in a minute
Thanks, it compiled now. However keep in mind there was a warning for sqlited.d: C:\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.5\sqlite-d\sour e\sqlited.d(743,5): Deprecation: Implicit string concatenation is deprecated, use "I do not expect us to ever get here\x0a" ~ "If we ever do, uncomment the two lines below and delete this assert" instead
Jan 28
prev sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 27 January 2017 at 12:01:30 UTC, Nestor wrote:
 Is there any other native D implementation of sqlite reader?
My sqlite.d and database.d from here can do it too: https://github.com/adamdruppe/arsd Just download those two files and compile them together with your file: dmd yourfile.d database.d sqlite.d However, my thing requires the C library, sqlite3, to be available already so it might not work out of the box for you either. import arsd.sqlite; auto db = new Sqlite("filename"); foreach(row; db.query("select * from foo")) writeln(row[0], row["name"]);
Jan 28
next sibling parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Saturday, 28 January 2017 at 19:01:48 UTC, Adam D. Ruppe wrote:
 On Friday, 27 January 2017 at 12:01:30 UTC, Nestor wrote:
 Is there any other native D implementation of sqlite reader?
My sqlite.d and database.d from here can do it too: https://github.com/adamdruppe/arsd Just download those two files and compile them together with your file: dmd yourfile.d database.d sqlite.d However, my thing requires the C library, sqlite3, to be available already so it might not work out of the box for you either. import arsd.sqlite; auto db = new Sqlite("filename"); foreach(row; db.query("select * from foo")) writeln(row[0], row["name"]);
It's not native though.
Jan 28
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Saturday, 28 January 2017 at 21:03:08 UTC, Stefan Koch wrote:
 It's not native though.
It's a mistake to ask for native D implementations of mature C libraries, especially a public domain one like sqlite. There's just no advantage in production use to rewrite it.
Jan 28
next sibling parent reply Nestor <nestorperez2016 yopmail.com> writes:
On Sunday, 29 January 2017 at 00:14:02 UTC, Adam D. Ruppe wrote:
 On Saturday, 28 January 2017 at 21:03:08 UTC, Stefan Koch wrote:
 It's not native though.
It's a mistake to ask for native D implementations of mature C libraries, especially a public domain one like sqlite. There's just no advantage in production use to rewrite it.
Well, native implementations are useful at least for building self-contained applications. Also, one can learn more advanced features of the language studying them. On the other hand, while for example C has a low overhead, I believe a properly optimized implementation in D could match and perhaps even surpass C code in terms of performance and safety, so at least for me, if someone has the knowledge and time to reimplement mature libraries in D, kudos to him/her, as a mere ignorant mortal I will certainly appreciate the effort. ;)
Jan 28
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Sunday, 29 January 2017 at 00:36:34 UTC, Nestor wrote:
 Well, native implementations are useful at least for building 
 self-contained applications.
Sometimes true, but sqlite can be easily embedded and statically linked, so your binary is still self-contained, there's just a small compile time dependency on the sqlite3.lib.
 Also, one can learn more advanced features of the language 
 studying them.
Oh, certainly, writing and studying it is a good thing.
Jan 28
parent reply Nestor <nestorperez2016 yopmail.com> writes:
On Sunday, 29 January 2017 at 02:55:04 UTC, Adam D. Ruppe wrote:
 On Sunday, 29 January 2017 at 00:36:34 UTC, Nestor wrote:
 Well, native implementations are useful at least for building 
 self-contained applications.
Sometimes true, but sqlite can be easily embedded and statically linked, so your binary is still self-contained, there's just a small compile time dependency on the sqlite3.lib.
 Also, one can learn more advanced features of the language 
 studying them.
Oh, certainly, writing and studying it is a good thing.
In the case of Windows, where libraries are usually dlls, how could this be achieved, using your wrapper for example?
Jan 28
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Sunday, 29 January 2017 at 02:59:12 UTC, Nestor wrote:
 On Sunday, 29 January 2017 at 02:55:04 UTC, Adam D. Ruppe wrote:
 On Sunday, 29 January 2017 at 00:36:34 UTC, Nestor wrote:
 Well, native implementations are useful at least for building 
 self-contained applications.
Sometimes true, but sqlite can be easily embedded and statically linked, so your binary is still self-contained, there's just a small compile time dependency on the sqlite3.lib.
 Also, one can learn more advanced features of the language 
 studying them.
Oh, certainly, writing and studying it is a good thing.
In the case of Windows, where libraries are usually dlls, how could this be achieved, using your wrapper for example?
dmd can link to dlls now. if just specify them on the commandline.
Jan 28
parent reply Nestor <nestorperez2016 yopmail.com> writes:
On Sunday, 29 January 2017 at 03:11:34 UTC, Stefan Koch wrote:
 On Sunday, 29 January 2017 at 02:59:12 UTC, Nestor wrote:
 On Sunday, 29 January 2017 at 02:55:04 UTC, Adam D. Ruppe 
 wrote:
 On Sunday, 29 January 2017 at 00:36:34 UTC, Nestor wrote:
 Well, native implementations are useful at least for 
 building self-contained applications.
Sometimes true, but sqlite can be easily embedded and statically linked, so your binary is still self-contained, there's just a small compile time dependency on the sqlite3.lib.
 Also, one can learn more advanced features of the language 
 studying them.
Oh, certainly, writing and studying it is a good thing.
In the case of Windows, where libraries are usually dlls, how could this be achieved, using your wrapper for example?
dmd can link to dlls now. if just specify them on the commandline.
Can dlls be embedded as well? I mean can I make a static dmd executable with the functionality of the library embedded and not just stored as a resource to be extracted and run at runtime?
Jan 28
parent Stefan Koch <uplink.coder googlemail.com> writes:
On Sunday, 29 January 2017 at 04:13:17 UTC, Nestor wrote:
 On Sunday, 29 January 2017 at 03:11:34 UTC, Stefan Koch wrote:
 On Sunday, 29 January 2017 at 02:59:12 UTC, Nestor wrote:
 On Sunday, 29 January 2017 at 02:55:04 UTC, Adam D. Ruppe 
 wrote:
 [...]
In the case of Windows, where libraries are usually dlls, how could this be achieved, using your wrapper for example?
dmd can link to dlls now. if just specify them on the commandline.
Can dlls be embedded as well? I mean can I make a static dmd executable with the functionality of the library embedded and not just stored as a resource to be extracted and run at runtime?
Not sure with a static libs you should.
Jan 28
prev sibling parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 01/28/2017 04:14 PM, Adam D. Ruppe wrote:
 On Saturday, 28 January 2017 at 21:03:08 UTC, Stefan Koch wrote:
 It's not native though.
It's a mistake to ask for native D implementations of mature C libraries, especially a public domain one like sqlite. There's just no advantage in production use to rewrite it.
Agreed but there can be happy surprises. :) Just because it's fresh in my mind: Jon Degenhardt implemented D versions of existing C, Go, and Rust tool kits in D and saw 3 to 10 times performance increase in many cases (not all). http://forum.dlang.org/thread/o6c9tj$2bdp$1 digitalmars.com Ali
Jan 28
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Sunday, 29 January 2017 at 01:02:07 UTC, Ali Çehreli wrote:
 Agreed but there can be happy surprises. :) Just because it's 
 fresh in my mind: Jon Degenhardt implemented D versions of 
 existing C, Go, and Rust tool kits in D and saw 3 to 10 times 
 performance increase in many cases (not all).
Yeah, but those are relatively simple tools, not a heavily used database like sqlite. I support the creation of sqlite-d, it does some cool stuff and there is potential for more, but I just don't agree that using the C functions should be a dealbreaker (or even a serious negative, given sqlite's nature especially)
Jan 28
prev sibling parent reply Nestor <nestorperez2016 yopmail.com> writes:
On Saturday, 28 January 2017 at 19:01:48 UTC, Adam D. Ruppe wrote:
 On Friday, 27 January 2017 at 12:01:30 UTC, Nestor wrote:
 Is there any other native D implementation of sqlite reader?
My sqlite.d and database.d from here can do it too: https://github.com/adamdruppe/arsd Just download those two files and compile them together with your file: dmd yourfile.d database.d sqlite.d However, my thing requires the C library, sqlite3, to be available already so it might not work out of the box for you either. import arsd.sqlite; auto db = new Sqlite("filename"); foreach(row; db.query("select * from foo")) writeln(row[0], row["name"]);
I have just tried your way and I get some errors: OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html app.obj(app) Error 42: Symbol Undefined _D4arsd8database3Row7opIndexMFkAyaiZAya app.obj(app) Error 42: Symbol Undefined _D4arsd8database3Row7opIndexMFAyaAyaiZAya app.obj(app) Error 42: Symbol Undefined _D4arsd6sqlite6Sqlite6__ctorMFAyaiZC4arsd6sqlite6Sqlite app.obj(app) Error 42: Symbol Undefined _D4arsd6sqlite6Sqlite7__ClassZ app.obj(app) Error 42: Symbol Undefined _D4arsd8database8Database5queryMFAyaYC4arsd8database9ResultSet app.obj(app) Error 42: Symbol Undefined _D4arsd6sqlite12__ModuleInfoZ Error: linker exited with status 163184408
Jan 29
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Sunday, 29 January 2017 at 16:26:30 UTC, Nestor wrote:
 dmd yourfile.d database.d sqlite.d
I have just tried your way and I get some errors: Error 42: Symbol Undefined _D4arsd8database3Row7opIndexMFkAyaiZAya
Are you sure you passed those two database.d and sqlite.d modules to the compiler?
Jan 29
parent reply Nestor <nestorperez2016 yopmail.com> writes:
On Sunday, 29 January 2017 at 17:36:45 UTC, Adam D. Ruppe wrote:
 On Sunday, 29 January 2017 at 16:26:30 UTC, Nestor wrote:
 dmd yourfile.d database.d sqlite.d
I have just tried your way and I get some errors: Error 42: Symbol Undefined _D4arsd8database3Row7opIndexMFkAyaiZAya
Are you sure you passed those two database.d and sqlite.d modules to the compiler?
I wasn't doing it explicitly. However I just did that and still encountered a few errors, which I removed with this patch: --- original\sqlite.d 2017-01-29 10:53:35 -0100 +++ modified\sqlite.d 2017-01-29 19:00:23 -0100 -22 +22,2 -import std.c.stdlib; +import core.stdc.string : strlen; +import core.stdc.stdlib : malloc, free; -143 +144 - sizediff_t a = std.c.string.strlen(mesg); + sizediff_t a = strlen(mesg); -164 +165 - sizediff_t a = std.c.string.strlen(mesg); + sizediff_t a = strlen(mesg); -285 +286 - sizediff_t l = std.c.string.strlen(str); + sizediff_t l = strlen(str); -335 +336 - sizediff_t l = std.c.string.strlen(str); + sizediff_t l = strlen(str); -558 +559 - p = std.c.stdlib.malloc(sz); + p = malloc(sz); -569 +570 - std.c.stdlib.free(p); + free(p); -626 +627 - sizediff_t b = std.c.string.strlen(columns[a]); + sizediff_t b = strlen(columns[a]); -632 +633 - sizediff_t d = std.c.string.strlen(text[a]); + sizediff_t d = strlen(text[a]); However a couple of errors remain with database.d which I don't know how to fix: arsd\database.d(644): Error: function std.json.JSONValue.type () const is not callable using argument types (JSON_TYPE) arsd\database.d(647): Error: function std.json.JSONValue.type () const is not callable using argument types (JSON_TYPE)
Jan 29
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Monday, 30 January 2017 at 00:06:00 UTC, Nestor wrote:
 I wasn't doing it explicitly. However I just did that and still 
 encountered a few errors, which I removed with this patch:
Where did you get that ancient version? The latest versions of the files work just fine out of the box, and they have for about a year now. these links work: https://github.com/adamdruppe/arsd/blob/master/database.d https://github.com/adamdruppe/arsd/blob/master/sqlite.d
Jan 29
parent reply Nestor <nestorperez2016 yopmail.com> writes:
On Monday, 30 January 2017 at 02:25:40 UTC, Adam D. Ruppe wrote:
 On Monday, 30 January 2017 at 00:06:00 UTC, Nestor wrote:
 I wasn't doing it explicitly. However I just did that and 
 still encountered a few errors, which I removed with this 
 patch:
Where did you get that ancient version? The latest versions of the files work just fine out of the box, and they have for about a year now. these links work: https://github.com/adamdruppe/arsd/blob/master/database.d https://github.com/adamdruppe/arsd/blob/master/sqlite.d
Well, I had downloaded the github version a few days back but yesterday managed to get dub to fetch properly, so I just fetched package arsd, and took the units from there. Anyway, I have just downloaded from github the files you recomend, but... d:\prj\sqltest2\source>dmd app OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html app.obj(app) Error 42: Symbol Undefined _D4arsd6sqlite6Sqlite6__ctorMFAyaiZC4arsd6sqlite6Sqlite app.obj(app) Error 42: Symbol Undefined _D4arsd6sqlite6Sqlite7__ClassZ app.obj(app) Error 42: Symbol Undefined _D4arsd6sqlite12__ModuleInfoZ Error: linker exited with status 163488904 If I specify all source files, there are even more problems: d:\prj\sqltest2\source>dmd app.d arsd\sqlite.d arsd\database.d OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html app.obj(app) Error 42: Symbol Undefined _sqlite3_open app.obj(app) Error 42: Symbol Undefined _sqlite3_finalize app.obj(app) Error 42: Symbol Undefined _sqlite3_prepare_v2 app.obj(app) Error 42: Symbol Undefined _sqlite3_mprintf app.obj(app) Error 42: Symbol Undefined _sqlite3_free app.obj(app) Error 42: Symbol Undefined _sqlite3_exec app.obj(app) Error 42: Symbol Undefined _sqlite3_last_insert_rowid app.obj(app) Error 42: Symbol Undefined _sqlite3_changes app.obj(app) Error 42: Symbol Undefined _sqlite3_errmsg app.obj(app) Error 42: Symbol Undefined _sqlite3_close app.obj(app) Error 42: Symbol Undefined _sqlite3_reset app.obj(app) Error 42: Symbol Undefined _sqlite3_column_blob app.obj(app) Error 42: Symbol Undefined _sqlite3_column_bytes app.obj(app) Error 42: Symbol Undefined _sqlite3_column_int app.obj(app) Error 42: Symbol Undefined _sqlite3_column_name app.obj(app) Error 42: Symbol Undefined _sqlite3_step app.obj(app) Error 42: Symbol Undefined _sqlite3_column_text app.obj(app) Error 42: Symbol Undefined _sqlite3_column_double app.obj(app) Error 42: Symbol Undefined _sqlite3_column_type app.obj(app) Error 42: Symbol Undefined _sqlite3_column_count app.obj(app) Error 42: Symbol Undefined _sqlite3_bind_null app.obj(app) Error 42: Symbol Undefined _sqlite3_bind_blob app.obj(app) Error 42: Symbol Undefined _sqlite3_bind_double app.obj(app) Error 42: Symbol Undefined _sqlite3_bind_int app.obj(app) Error 42: Symbol Undefined _sqlite3_bind_text Error: linker exited with status 211947944 Source of app.d couldn't be simpler: import std.stdio; void main() { import arsd.sqlite; auto db = new Sqlite("data.db"); } Files sqlite3.{def|dll|lib} are on both source/ and source/arsd/ (just in case) I also moved your files to the same location of app.d but it makes no difference.
Jan 29
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Monday, 30 January 2017 at 02:46:34 UTC, Nestor wrote:
 Well, I had downloaded the github version a few days back but 
 yesterday managed to get dub to fetch properly, so I just 
 fetched package arsd, and took the units from there.
Oh, that is ancient and not even mine - I don't have access to it, it was set up by a third party years ago!
 d:\prj\sqltest2\source>dmd app
That is always wrong unless your entire program consists *only* of app.d. When compiling, you need to have imported modules available or you'll see "module foo is found in file foo.d that cannot be found", and when linking, you need to have the code available or you'll see "Symbol Undefined". Since compiling and linking are done in the same step unless you ask it not to, missing modules may lead to one, the other, or both. The easiest solution is to pass all the modules to the compiler at once. Then it will be able to find them for import and will compile and link them automatically. If you link separately (such as to a .lib or .dll), you can specify them rather than all the .d files, but it still needs the .d for the import! Whether it is library modules or another module in your own file, it is the same, they all need to be there.
 If I specify all source files, there are even more problems:
  Error 42: Symbol Undefined _sqlite3_open
It apparently couldn't find sqlite3.lib.
 Files sqlite3.{def|dll|lib} are on both source/ and 
 source/arsd/ (just in case)
Try specifying it on the command line too: dmd app.d database.d sqlite.d sqlite3.lib Though this may still require sqlite3.dll there too, unless it was built statically.
Jan 29
parent Nestor <nestorperez2016 yopmail.com> writes:
On Monday, 30 January 2017 at 03:07:22 UTC, Adam D. Ruppe wrote:
 If I specify all source files, there are even more problems:
  Error 42: Symbol Undefined _sqlite3_open
It apparently couldn't find sqlite3.lib.
 Files sqlite3.{def|dll|lib} are on both source/ and 
 source/arsd/ (just in case)
Try specifying it on the command line too: dmd app.d database.d sqlite.d sqlite3.lib Though this may still require sqlite3.dll there too, unless it was built statically.
I found out the cause of the problem. First I tried to verify if the linker was able to find sqlite3.lib using Process Monitor by Mark Russinovich, and at least there were IRP_MJ_CREATE, FASTIO_QUERY_INFORMATION, IRP_MJ_READ and FASTIO_READ operations with the correct path to sqlite3.lib where the result was SUCCESS, so apparently the linker could find the file. So I opened sqlite3.bn in notepad++ just to see the name of the symbols and not even one started with an underscore, so I created sqlite3.lib again with these arguments and this time it compiled: implib /system sqlite3.lib sqlite3.dll
Jan 30