Page 1 of 1

Compile during runtime

Posted: Wed Aug 03, 2005 7:07 am
by SebMcClouth
Heheheh... yes I need to perform this action...

I'll draw the scene for ya:

I'm running my code which could be installing another program...
Now I want my program to able to compile a program (.bas) as well as a library. How can I achieve this if I have the needed qb-files along with it?

BTW You could intreprete this also as the following question: How can I achieve a commandline compile??

grtz

Seb

Posted: Wed Aug 03, 2005 9:52 am
by Antoni

Code: Select all

bc myfile.bas,,;
link myfile.obj,,,path_to_bcom45.lib;
both BC.EXE and LINK.EXE are in the QB directory.

You have a complete description of QB's command line at
http://qbcm.hybd.net/issues/1-9/#btau

Posted: Wed Aug 03, 2005 9:59 am
by SebMcClouth
That's all??

grtz
Seb

Posted: Wed Aug 03, 2005 10:28 am
by Antoni
Let me correct it..

Code: Select all

bc /o myfile.bas,,;
link myfile.obj,,,path_to_bcom45.lib;
Yes, that's all for a simple source, not using ON ERROR or "ON anything",and not using external libraries.

At the end you will have to delete a myfile.obj, myfile.map, and myfile.lst.

Posted: Wed Aug 03, 2005 10:31 am
by SebMcClouth
What if I have to compile a file that needs a library... for example:

Code: Select all

'$include:'sumfin.bi'
grtz?

Posted: Wed Aug 03, 2005 11:08 am
by Antoni
Does it mean you have a sumfin.lib to link?

in that case it wuld be:

Code: Select all

bc /o myfile.bas,,;
link myfile.obj,,,path_to_bcom45.lib sumfin.lib ; 

Posted: Wed Aug 03, 2005 11:43 am
by SebMcClouth
Ah okay thx...

Can I compile it like this:

Code: Select all

shell "bc /o myfile.bas,,;"
shell "link myfile.obj,,,path_to_bcom45.lib sumfin.lib ;"
Grtz

Seb

Posted: Wed Aug 03, 2005 12:05 pm
by Antoni
Yes, it should work.
Try it first keying in the commands from a dos prompt, as you may have to specify paths.

having never tried it...

Posted: Wed Aug 03, 2005 12:44 pm
by mennonite
i figured it was at least that simple...

i don't understand though, what difference would On Error make, and what would you do then? erm, whats the most complicated command you would need to compile a single module with a single included library?

Posted: Wed Aug 03, 2005 2:51 pm
by Guest

Code: Select all

 
::bc program [/options] [, object] [, listfile] [;]
:: /a    include asm in the list file   
:: /ah   huge arrays  
:: /c### comms receive buffer size
:: /d    debug check ctrl_brk + int overflow + array bound + check gosub/return    
:: /e    on error`+ resume number
:: /mbf
:: /o    standalone
:: /r    arrays last index first
:: /s    fast strings
:: /t    terse 
:: /v    check emulated events ON... on every statement
:: /w    check emulated events ON... on every numbered line
:: /x    RESUME, RESUME NEXT, RESUME 0
:: /zd   add line info for use with Symbdeb
:: /zi   add line info for use with codeview  
::  ;    don't ask for missing params
and for link

Code: Select all

::link [/options] objfile [objfile] [libfile.lib], [exefile], [mapfile],  [libfile] [libfile] [;]
:: /BATCH                         /BINARY
:: /CODEVIEW                      /CPARMAXALLOC
:: /DOSSEG                        /DSALLOCATE
:: /EXEPACK                       /FARCALLTRANSLATION
:: /HELP                          /HIGH
:: /INFORMATION                   /LINENUMBERS
:: /MAP                           /NODEFAULTLIBRARYSEARCH
:: /NOEXTDICTIONARY               /NOFARCALLTRANSLATION
:: /NOGROUPASSOCIATION            /NOIGNORECASE
:: /NOPACKCODE                    /OVERLAYINTERRUPT
:: /PACKCODE                      /PACKDATA
:: /PAUSE                         /QUICKLIBRARY
:: /SEGMENTS                      /STACK
Normally all of this is dealt with by the IDE...

The link in my previous post details every option (and some more that a pplies to PDS)

holy crap!

Posted: Wed Aug 03, 2005 4:07 pm
by mennonite
if it weren't for the ide, you might as well be compiling c code! who knew it was so complex!?

Posted: Wed Aug 03, 2005 11:40 pm
by SebMcClouth
How I compile it like the ide does??

grtz
Seb

Posted: Thu Aug 04, 2005 2:16 am
by Guest
I see no point in "compiling like the ide" as far as the method you have works.

The ide does a lot of things in the background:

-It preprocesses the sources: you can have it to compile things with '$include:' files in places specified in the "Options>Directories" menu. If you compile from command line you must edit the source and specify the include dir there, you can't do it in the command line.

-It parses the source to find if the switches /e, /x, /v or /w apply and sets them automatically. It's not smart enough to specify /ah or /l, you must specify those when calling the IDE.

-The linker uses the /batch option and have every other parameter set in a command file file that's erased at the end of linking. If you break somehow a linkage you will be able to check it it.

Posted: Thu Aug 04, 2005 3:42 am
by Seb McClouth
I found some code in the ABC packets which seems helpfull, let's hope it works... else I'd be posting here again, but thx for the help!!

grtz
Seb