Basic SQLite Application

harakim harakim at gmail.com
Wed Jun 1 03:46:38 UTC 2022


I'm creating an application in D to do some purchase management 
stuff and I ran into a snag pretty early on. I'm trying to use 
sqlite via [this 
library](https://github.com/adamdruppe/arsd/blob/master/sqlite.d).
I started trying to get it to compile in another directory 
structure but since I've switched to dub and made a few tweaks, 
it compiles and runs and returns some large negative number as an 
error without printing what's in the writeln.
Here is my dub file:
```
{
	"authors": [
		"onesadman"
	],
	"dflags" : ["-m64"],
	"copyright": "Copyright © 2022, onesadman",
	"description": "Costco Purchase History",
	"license": "proprietary",
	"name": "cph",
	"libs-windows": ["lib/sqlite3"],
	"copyFiles":["lib/sqlite3.lib"]
}
```

Here is my program:
```
import std.stdio;
import arsd.sqlite;

void main()
{
	writeln("Edit source/app.d to start your project.");
}
```
I also have database.d and sqlite.d in my source/arsd directory 
and a lib folder with sqlite3.lib in it. It is successfully 
copied to the root folder and I also copied sqlite3.dll from 
c:\windows\sysWOW64\winsqlite3.dll into the root folder just in 
case I was doing it wrong and that fixed it.

It seems I must be close as I have it compiling. I'm not sure 
where it's going to look for the lib folder.

I have run it with dub and with  dub build --arch=x86_64 and then 
running the cph.exe directly.

I won't rule out that my lib file is the wrong file as I don't 
know how to tell or find the right one.


More information about the Digitalmars-d-learn mailing list