Sample link line for main module and multiple modules

447 views
Skip to first unread message

Dan Campbell

unread,
Sep 22, 2016, 3:27:13 AM9/22/16
to multisoft FlagShip
Hi,

If you don't want to use a make file, and your .objs are already compiled, what Flagship command line can be used to link the main module in with multiple modules (.obj), and a .lib?

Can you use a list file (e.g. @listobjs.lst like the old days) on the command line?

I know that -M is used for the main module, but I'm not clear on how to link in all of the secondary objs with the .lib, to produce an executable.  I never liked Borland's make system.


Paul

unread,
Sep 22, 2016, 4:00:31 AM9/22/16
to multisoft...@googlegroups.com
In FlagShip, you can use either .prg or .c sources, and/or .obj and .lib objects to create native executable. Usually, you compile from .prg sources:

 FlagShip myfile*.prg any*.prg -Mmystart -o myapplic.exe

To link with already compiled objects, use

  FlagShip myfile*.obj any*.obj other.lib -Mmystart

You may combine sources and objects during one compilation as well:

 FlagShip myfile*.prg any*.obj other.lib -Mmystart -o myapplic.exe
 

Instead of wildcards, you of course may specify all the file names. Detailed description is available in the manual section FSC.

Hint: To create template for "make" semi-automatically (and to compile only changed files), use the "fsmake" tool described in the manual section FSC.6.9

Paul

Dan Campbell

unread,
Sep 25, 2016, 7:11:28 AM9/25/16
to multisoft FlagShip
Paul, thanks.  


This is the one I'm interested in:

FlagShip myfile*.obj any*.obj other.lib -Mmystart


, and I used it in one of the make files.  But because there were so many object files, there was an error that the command line was too long.


Is the wildcard in any*.obj literal?  Can wildcards be used?

What about list files, with a list of an object file on each line?  Is that possible?

Paul

unread,
Sep 26, 2016, 3:35:19 AM9/26/16
to multisoft...@googlegroups.com
The string passed to linker needs to contain all the file names your application use and also compile/linking switches. It does not make any difference, when you pass explicitly all the file names, or use wildcards, or create the string by concatenating the input from several lines. You can check the passed string from FlagShip to linker by -v switch, e.g. :

  FlagShip -v myfile*.obj any*.obj other.lib -Mmystart -o myapplic


> But because there were so many object files, there was an error that the command line was too long.

In Windows (from XP to Windows 10), the limitation of command-line size is 8191 characters (see https://support.microsoft.com/en-us/kb/830473), hence the passed string cannot exceed this limitation, otherwise Windows reports error.

To work around the limitation, use one or more of the following methods:

● Concatenate small program functions into one (or several) source files. For example instead of above any*.obj (= any1.obj to any20.obj) concatenate the source of any1.prg ... any10.prg --> udfs1.prg and any11.prg ... any20.prg --> udfs2.prg by your program editor, then compile

  FlagShip -v udfs1.prg udfs2.prg myfile*.obj other.lib -Mmystart -o myapplic

● Create user library (e.g. mylib.lib) containing some of your procedures and functions, for example your myfile1.prg to myfile5.prg by using the BCC32 librarian:

   # open FlagShip console
   FlagShip -c myfile*.prg                     # creates myfile1.obj to myfile5.obj
   tlib mylib.lib +myfile1.obj +myfile2.obj +myfile3.obj
   tlib mylib.lib +myfile4.obj +myfile5.obj    # note: no wildcards with tlib
   FlagShip any*.obj mylib.lib other.lib -Mmystart -o myapplic.exe


● Combine both above methods and execute:

   FlagShip udfs1.prg udfs2.prg mylib.lib other.lib -Mmystart -o myapplic.exe

Note: in the above examples is "mystart" the name of your start procedure and "myapplic" the name of produced executable - adapt to your real needs.


> Is the wildcard in any*.obj literal? Can wildcards be used?

The star * in above file names (e.g. any*.obj or myfile*.prg) is a wildcard, FlagShip resolves the entry "any*.obj" to e.g. "any1.obj any2.obj ... any19.obj any20.obj".
See also my previous reply and the manual section FSC.1.2 and FSC.1.6 for further details.

Paul

Dan Campbell

unread,
Sep 26, 2016, 1:32:04 PM9/26/16
to multisoft FlagShip
Good information, thanks Paul.
Reply all
Reply to author
Forward
0 new messages