Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Steps to compile/link in clipper.

Status
Not open for further replies.

Alex06

IS-IT--Management
Oct 11, 2006
3
US
Hello,

I've got an application in Clipper. The application runs from a specific folder where the .prg, .obj, and .exe files reside.

I already modified the program ciediar.prg but I don't know the process to compile and/or link my new ciediar.prg with the current control.exe in order for it to recognize the changes.

Thanks in advance
 
Usually there are batchfiles set up to accomplish that task, didn't the original programmer make any of them? Could also be a .rmk file, as it used to be the default extension for RMake scripts. (RMake is a sort of make tool, not very compatible with either Gnu, Borland or MS make) (RMake docs are in the Norton Guides)

HTH
TonHu
 
Thanks for your help TonHu.

I forgot to mention that I am not a Clipper expert. I used a batch file to compile my program (cl.bat) wich contains the following lines:

clipper %1 -B
if not errorlevel 1 rtlink file %1


My understanding is that the first line is the compilation process but I'm not sure what the second line does. I compiled my ciediar.prg using the cl.bat and put the new ciediar.obj in the application folder where the control.exe (the application) is located.

What exactly does the rmake tool do? I found this rmake.exe file under the clipper folder.

I appreciate your help.

Thanks!
 
Hi Alex
The first line does compile the .prg file, the second links it with the standard libraries to make an .exe file.

That's probably just intended for 'quickie' fixes - the application itself will probably involve compiling a series of .prg files (which then become .obj files) and then linking them all together to make one (much larger) .exe file.

Are there any other .bat files 'lying around'?

Myself, I use a .bat file called mk.bat this calls a utility called 'make', or 'rtmake' sometimes, which scans a list of .prg files, comparing them with their matching .obj files and only recompiles those that are newer - then calls the linker (in your case rtlink) to combile them in a predefined fashion to create a named .exe file.

Can you see much like that ? Often these won;t work without some environment variables being set first (to tell the system where to find the linker, libraries and .obj files).



Regards

Griff
Keep [Smile]ing
 

Thanks Griff,

I think I almost get to the link process. Do you know what is the syntax to link the .obj files? How do I run the rmake program? How do I reference the corresponding libraries?

I appreciate your help!
 
If your mod was just to one .prg file, then the 'make' is pretty much redundant - you can just compile you .prg to make the obj. So long as you know what options to use; such as -m or what ever.

I'm not sure if there is a standard for make file extensions, I use .MK5 yours might be .rmk or .mak or something else.

Essentially you'd be calling the rmake utility with that file as the parameter:

Code:
c:\utils\rmake myfile.mk5

This will then (probably) call a batch file to compile each .prg with a command line something like:
Code:
call cl50obj myprog

In turn that will probably have something like this in it:
Code:
c:\lang\cl50\bin\clipper %1.prg -m %2 %3 %4 -ustd.ch -oOBJ\%1.obj

This assumes that the clipper compiler is in the c:\lang\cl50\bin folder.

%1 would be the parameter passed to the batch file with the .prg name (the .prg itself being omitted deliberately)

-m means compile the files specified in a module
-ustd.ch tells the compiler to look in std.ch for any odd command preprocessor instructions
-oOBJ\%1.obj tells the compiler to use the file name specified in the parameter again to direct the compiler output to a file in a subfolder called OBJ and to put the .obj extension on it!

%2 %3 %4 are just in case extra parameters are uses to include extra .prg files.

After that we have linking!

I use another script for this in my case with a .lk5 extension - but there is a standard for this one! it is .lnk and it will typically contain something like this:

Code:
BLINKER EXECUTABLE CLIPPER F225;E0;
#BLINKER HOST MESSAGE ON
BLINKER INCREMENTAL OFF
BLINKER EXECUTABLE EXTENDED
# output file
OUTPUT \apps\myprog\WORK\myprog
OVERLAY CODE,$CONSTANTS
# burn in the clipper variables...
# core part in memory
FI obj\myprog
FI obj\DOSPROC
FI obj\genproc
FI OBJ\ARRAPROC
FI OBJ\TBROPROC
FI OBJ\ERRORSYS

   search C:\LANG\cl50\lib\BLXCLP50
   LIB C:\LANG\cl50\lib\clipper
   search C:\LANG\cl50\lib\EXTEND
   search C:\LANG\cl50\lib\dbfntx
   search C:\LANG\cl50\lib\terminal
#  search cl

BEGINAREA
        SECTION FI OBJ\PRINFUNC
        SECTION FI OBJ\PROJPROC
        SECTION FI OBJ\CONTPROC
        SECTION FI OBJ\CNTRPROC
ENDAREA

The example is for Blinker - but is similar to RTLink (I think)

You might not need the environment variables, because the paths etc are specified in the .lnk/.lk5 file.

So you are just left invoking the whole thing:
Code:
c:\utils\blinker @mylink.lk5

The @ tells the linker to take it's instructions from the specified file

I hope this all helps and good luck to you




Regards

Griff
Keep [Smile]ing
 
The example is for Blinker - but is similar to RTLink (I think)

Sorry to say, but that was the other way around... Blinker has a (sort-of but not usefull) RTlink compatible mode.

I looked up an old RTlink script (1993) I never use anymore, but it should still work ;-)
Code:
# Linkscript for .RTLink
Resident
# Main program-module
File Z
Dynamic
# Several obj-files, dynamically loaded:
File Init, Aanmaak
File Hoofd1, Hoofd2, Hoofd2, Hoofd3, Hoofd4, Hoofd4
# libraries:
Search TK91, SubNTX, Expand, NanFor
# exe-name:
Output Z

HTH
TonHu
 
Hi TonHu,

It's not the same is it! B-)

With your example he should be able to fine any existing ones though...

Thanks

Martin

Regards

Griff
Keep [Smile]ing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top