BBC BASIC for Windows
Programming >> Libraries >> My own library
http://bb4w.conforums.com/index.cgi?board=libraries&action=display&num=1459359617

My own library
Post by KenDown on Mar 30th, 2016, 5:40pm

I recently wrote a program - never mind what it does, not important - and for versatility had it load a library from @dir$. The library is a .bbc file of procedures and functions and everything works as it should on my computer, which has BB4W on it.

I compiled the program (still no problem) and then tried to run it on another computer which does not have BB4W on it. The program now fails to run and I am wondering whether I need to do something special with the library or whether the library won't work without the BB4W program or whether it is just Windows 10.

Anyone got any ideas, please?
Re: My own library
Post by michael on Mar 30th, 2016, 6:01pm

You will need to talk to Richard. Here is the link

http://bbcbasic.conforums.com/index.cgi
Re: My own library
Post by KenDown on Mar 30th, 2016, 6:30pm

Thanks. Er - are you sure? The stated purpose of that message board is support for a Linux version of BBC BASIC - BB4L.
Re: My own library
Post by sveinioslo on Mar 30th, 2016, 6:32pm

If you have read and followed:
http://bb4w.wikispaces.com/Guide+to+writing+libraries
and perhaps
http://bb4w.wikispaces.com/Distributing+crunched+libraries
and perhaps
http://bb4w.wikispaces.com/Prompting+for+admin+rights
then the only thing i can come up with is to write short test programs to isolate whatever the fault may be.
Try this:
Code:
REM Program , save as test.bbc
INSTALL @dir$+"testlib.bbc"
A%=5
PRINT A%,FNtest(A%)
END 

Code:
REM Library , save as testlib.bbc
DEF FNtest(B%) : =B%+1 

Compile test.bbc and check if test.exe will run on both machines.
If not then check if the antivirus plaque has got anything to do with it.
Unless you are using a lot of windows api calls, windows 10 should not be the issue.
Good luck.
Svein


Re: My own library
Post by RNBW on Mar 30th, 2016, 8:11pm

To Ken Down

Quote:
Thanks. Er - are you sure? The stated purpose of that message board is support for a Linux version of BBC BASIC - BB4L.


Michael is correct. If you want to contact Richard then http://bbcbasic.conforums.com/index.cgi is the correct place to go.
Re: My own library
Post by KenDown on Mar 30th, 2016, 9:37pm

Thanks to both for your replies. My library follows the recommendations in the first URL, is not crunched, and so far as I know does not require administrator privileges. Yes, I will do some more work on it, but I need to run it on a computer that is not in my possession, so it may take a while before I can get hold of it.

Thanks again.
Re: My own library
Post by DDRM on Mar 31st, 2016, 09:22am

Hi KenDown,

You can also email Richard directly ( info@rtrussell.co.uk ) - or I think you have his "personal" email, too. The BBCBASIC conforum did start out as being focussed on the LINUX/ANDROID version, but I think he is also providing BB4W support there - you could try and see!

However, I'd have thought it ought to be soluble.... When you compile your main program, is it including your library in the "embedded files" list at the bottom of the compile window? Is it listing the folder correctly?

Best wishes,

D
Re: My own library
Post by KenDown on Mar 31st, 2016, 1:28pm

No, it doesn't embed the library - that is the whole point of the library, that the user of the program can add to the library and thus expand the functionality of the program without having to mess around with the main program and possibly muck it up.
Re: My own library
Post by Zaphod on Mar 31st, 2016, 3:59pm

So you are supplying a library separately to the user that will be in the same directory as the program, and that the user can alter?

The main program in the executable must not have the default settings or it will be crunched and so not recognize the library function names. The "abbreviate Names" option must be un-checked.

I also wonder about this technique as the requirements as to how a library is organized is more arduous than the main program. It is just as easy to "muck up" a library. A library will contain functions and procedures only, not normally any data. Are you sure that some other configuration isn't a better option such as a CALL to a program that sets up the variables, or even the venerable INI file?
Re: My own library
Post by KenDown on Mar 31st, 2016, 7:30pm

Thanks for the reply.

I never crunch the names. It's too useful to be able to use them if the program crashes!

The program displays text and pictures in a carousel that loops continuously. The library contains transitions such as vertical or horizontal wipes and the user can write a new transition - say a diagonal wipe - which he can then use. The basic program does not use the library; its functions and procedures are only called by the user who can specify that picture A transitions to picture B with PROChorizontal(speed) or however he has set it up.

I don't think a CALL or an ini would do that.
Re: My own library
Post by Zaphod on Mar 31st, 2016, 11:19pm

Quote:
I never crunch the names. It's too useful to be able to use them if the program crashes!

You have raised my curiosity as to how you would use them after the crash of the executable. But perhaps that is another topic.

On the original question you said "The program now fails to run " perhaps if you could expand on that.

I have done something very similar to Svein and run the executable with no embedded library and with the library in the same directory on a thumb drive. I have moved that from machine to machine.
It works on all my machines from XP to Windows 10, with BB4W 5.95a and 6.02a.
There is something else going on I am afraid.

As for that CALL thing, there is a very interesting topic from a few years ago.
http://bb4w.conforums.com/index.cgi?board=language&action=display&num=1235907869

Re: My own library
Post by Zaphod on Apr 2nd, 2016, 8:16pm

I was reading the conversation on BBCBASIC and you might well be able to use the Demo version of BB4W to edit the "Library" on the destination machine.

I think you are not quite up to speed on how the libraries are installed. If the library is in the @lib$ directory, when they are embedded they are extracted and installed from a temporary @lib$ folder and then the @lib$ folder on the runtime machine is deleted so there is nothing left to "muck up" the machine. I know that this is not what you are doing here but I was just commenting.
If you want stuff NOT to get left on the run time machine you generally DO embed and install from @lib$ not @dir$. I grant you that you can't do that in your current application.

I am still confused how the main program would know that additional transitions had been added and so offer those options, although I think I could probably come up with a scheme.
Re: My own library
Post by KenDown on Apr 3rd, 2016, 04:04am

Hi,
Yes, so far the library is small enough that I believe it will fit within the demo version. I provide some tips on programming in the accompanying documentation. Of course, one can always hope that a user who gets into programming via the demo version will go on to buy the full version.

Some people get quite "thingy" if you suggest installing a program on their computer, which is why my programs are never installed. I can run it from a memory stick or portable drive and once I have finished with it there is nothing left on the other person's computer. (For example, my improved version of PowerPoint, which may need to be run on the computer belonging to the church where I am speaking.)

If you alter the library you would need to re-run the program, which then loads in the altered library. The program requires a text file which specifies the contents of the different "frames" - pictures, text, etc, the time the frame is displayed and also specifies the transitions between the frames. You create a new transition, you specify it in the text file and it gets used. Voila!