QB64 Phoenix Edition
Library help - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: Library help (/showthread.php?tid=1316)

Pages: 1 2


Library help - Pete - 12-21-2022

Anyone know where I can find a cute librarian? Oops, wrong forum...

I'm finding I'd like to have several shorter libraries, rather than combined functions made into a single libraries. For example, I can have a single gui library that creates a form, allows user selection and input, and produces menus, or...

I can have...

Keyboard / Mouse library
Menu library
Form library
Input Text library

What's cool is each of the above could be ported to other apps.

So here's my options...

1) Each library loads the DIM SHARD statements into the main.

2) I have to pass all variables from every library I create, regardless if libraries I include in my app only use some of those variables and arrays.

Frankly I'm leaning towards option 1. To get around naming issues, I'd go with naming the variables in relation to the library they are best associated with like MyMenuChoices$, etc.

What do you guys think or do?

Pete


RE: Library help - bplus - 12-21-2022

I would say it depends how much one library shares code or shared variables with another also how much code is actually relevant to the combined project.

I would probably combine 4 to 1 in both Bi and BM just to be assured they will play nice together without redundancy and be rid of the irrelevant.

If all 4 were completely independent, nothing shared, it would be easy to just include the 4 sets specially if all or most were relevant to the app.


RE: Library help - Pete - 12-21-2022

That's the thing. N0 real 'master plan' as of yet, so I'm thinking I need the versatility, which is my option #1.

Pete


RE: Library help - SpriggsySpriggs - 12-21-2022

I like the idea of each piece being separate enough to be able to be included in anything else without being dependent on any of the others. I sometimes use shared variables but I do my best to steer clear of them. They're very necessary, though, in certain cases.


RE: Library help - Pete - 12-21-2022

Yes, I'd love it if there were no variable dependencies, but take for instance a mouse and keyboard library. All modules that call it will be dependent on the variables of position, click event, key press, etc. Actually, I think just about every complex app I've ever coded had multiple variable dependencies. In the early days of multi-modular programming, I used a lot of COMMON SHARED to deal with those situations.

Pete


RE: Library help - Kernelpanic - 12-21-2022

(12-21-2022, 08:22 PM)Pete Wrote: Anyone know where I can find a cute librarian? 
Pete

Of coures!  Tongue

Librarian


RE: Library help - SpriggsySpriggs - 12-21-2022

It'd be cool if you were able to use QB64pe to make DLLs without some weird hacky way.


RE: Library help - Pete - 12-21-2022

Funny, I used to say exactly the same thing about QuickBASIC. I did hack my way around that. Also, it turned out QuickBASIC would execute a RUN "my.dll" exactly the same as it would an exe.

Pete


RE: Library help - Pete - 12-21-2022

(12-21-2022, 10:10 PM)Kernelpanic Wrote:
(12-21-2022, 08:22 PM)Pete Wrote: Anyone know where I can find a cute librarian? 
Pete

Of coures!  Tongue

Librarian

What? She has books in front of her stack. DO BETTER!

Pete Big Grin


RE: Library help - Kernelpanic - 12-21-2022

Wait, this was wrong here! 

[Image: oops1.gif]