Page 1 of 1

Dynamic linking in QBasic?

Posted: Mon Nov 02, 2009 9:02 am
by angros47
Is there a way to dynamically link a library in QBasic, like it has been done in Seal?

The idea is:

main program:

Code: Select all

call LibEntryPoint
Library 1:

Code: Select all

SUB LibEntryPoint
PRINT "this is library 1"
Library 2:

Code: Select all

SUB LibEntryPoint
PRINT "this is library 2"
And, at runtime, I wish to be able to unload library 1 and load library 2.

Can it be done (maybe using overlays)?

Posted: Tue Nov 03, 2009 2:37 pm
by burger2227
I've never heard of unloading a Library. Why would you need to?

Posted: Tue Nov 03, 2009 4:03 pm
by angros47
I was thinking about a sort of cooperative multitasking in qb (in a way similar to Seal, but made in QB). To load multitasking programs, I'd need dynamic linking, and also pointers and callbacks.

Has anyone ever tried something similar? I know about Gimi, and others multitasking systems in QB using scripts, but could be done using real machine code instead of an interpreted script?

Posted: Thu Nov 05, 2009 4:56 pm
by Nodtveidt
No...there is no way to do this with traditional QB. QB PDS has something sort of what you're looking for, but it's not exactly the same.

Posted: Fri Nov 06, 2009 2:46 am
by angros47
Can be done in QB PDS? How? Can you tell me more?


Posted: Fri Nov 06, 2009 2:59 am
by burger2227
The only way that I can think of is to use 2 separate modules. Each runs one Library using RUN or CHAIN.

CLEAR clears all variables and closes all open files.

Whether RUN or CHAIN can close one is questionable. I'll ask if it is possible and can be proven somewhere else.

I still don't see the big deal however.

Posted: Mon Nov 09, 2009 9:00 am
by angros47
I was thinking...

Maybe it could be done using TSR with some "tweaks"...

I.E. every application is a TSR, the "kernel" manages the GUI and calls interrupts to activate single apps, and a segment of ram is used as "interface" (if an application has to open a window, it leave a message in the common area, and the kernel read it and open the window).
In that way, I will also be able to mix programs written in QB and in other languages.

Do you think that it could work?

I've downloaded, but there is no doc. Of course I'm not going to buy external libraries. Does anybody know how to make a TSR that is not enabled by hitting a key, but by using (for example) a POKE in a qb program?