How to use a Library

Discussions related to database technologies, file handling, directories and storage
hinckleyj
Posts: 25
Joined: Sat 02 Jun 2018, 08:02

How to use a Library

Post by hinckleyj »

Hi All,

Sorry if this is a really basic question, but how do you actually 'use' a Library?

I understand what a Library is and I can see example programs using them. However, I cannot find anywhere where it states where to put that Library file.

For example, in the BBC Wiki there is a demo program showing how to create a Phone Number database using a SQLite database.

The first line installs the required library
INSTALL @lib$+"SQLite"

However, mine throws an error and I am assuming its because it cannot find the library.

Where do you put that library file? Is there a default path for it?

Thanks in advance.
DDRM

Re: How to use a Library

Post by DDRM »

Hi Hinkleyj,

By default @lib$ points to the LIB folder which is in the BBC Basic installation - that's where libraries should be by default, too.

I don't think SQLite is one of the "standard" libraries, is it? You will need to find a copy, and then put it somewhere - ideally in the LIB folder. Note that with a default install this is likely to be in a "protected" location, so you may need administrator privileges to save things there.

Alternatively you could put it in the same folder as your program, and then access it using @dir$ +"libname" - assuming @dir$ points there, which it will if you loaded the program from there and haven't changed it in the meantime.

If that doesn't solve your problems, come back - it would be useful if you can specify the error that is being generated.

Best wishes,

David
hinckleyj
Posts: 25
Joined: Sat 02 Jun 2018, 08:02

Re: How to use a Library

Post by hinckleyj »

Hi David,

Thanks for replying to this.

The error was "Error opening file in module <path>"

I've copied the SQLite Library file to the location in <path> and this has indeed solved the problem. I didn't know it looked in that location and none of the documentation stated this (that I could see anyway).

Perfect. Cheers :D

Thank you for your help.

John
DDRM

Re: How to use a Library

Post by DDRM »

Hi John,

The hint is in the "@lib$+"!

:-)

D
KenDown
Posts: 327
Joined: Wed 04 Apr 2018, 06:36

Re: How to use a Library

Post by KenDown »

You can have a library anywhere you want. In one of my programs I have a user library which is stored in @dir$+"UserLib.bbc". It works just fine.