Qbasicnews.com

Full Version: Making ASM libraries for QB
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How would I do it? I'm really lost here.
I'm using MASM 6.15.
I suppose I'd have to make the OBJs and then LIB and LINK them? If so, how?
You have to compile them using the MEDIUM memory model and the Pascal calling convention. I've never done that, so I guess more experienced posters will elaborate Big Grin
Hmm...Wouldn't we want the BASIC model specifier, not PASCAL?
Code:
.model medium, BASIC
I didn't even know that that existed. If you knew it, why did you ask? Tongue

All I know is that QB passes parameters using the Pascal "order". You have to declare your functions "pascal" in C if you want to write a library in C, I just thought it was the same with assembly.
Well - maybe QB differs from "BASIC". :lol:
No, my question is mainly how do I turn my objs into a .qlb?
Still asking asm questions here? Smile
A qlb is only needed when you want to use the library inside the qb IDE. Otherwise you use .obj files directly when you link or .lib files which are just a collection of .obj files in one file. Using masm use this frame

Code:
.model medium, basic
                .386
                .code
                
mybasroutine    proc    public uses someregs,\
                        arg1:word,\
                        arg2:dword
                        
                local   mylocalvar:dword
                
                ;;
                ;; Code here
                ;;
                
                ret
mybasroutine    endp
                end

Then to create a .lib do this

ml /c myobj.asm
lib mylib +myobj.obj;

And to create a qlb do this
qb 4.5: link /q mylib.lib,mylib.qlb,nul,bqlb45.lib;
qb 7.1: link /q mylib.lib,mylib.qlb,nul,qbxqlb.lib;
vbdos 1.0: link /q mylib.lib,mylib.qlb,nul,vbdosqlb.lib;

The only thing that differs qb 4.x libs (not qlbs) to pds/vbdos libs is that the later uses far strings, so that's something you'll have to think about if you're building a lib for all of them. Atleast i think that's the only thing that differs them, i don't remember. But i'm pretty sure.