Linking S'87 Clipper files with C files 
Author Message
 Linking S'87 Clipper files with C files

Hello to everybody.

I hope some of the older clipperheads can help me solve this:

I am trying to link together some S '87 clipper obj files with a simple
program written in C.
Both the clipper files and the C prg give perfectly working *.exe files if
compiled and linked separately (using of course Clipper + Tlink for Clipper
files and TCC v. 3.0 for the C file).
However, if I try to link them in a single *.exe file I get nowhere.
For sure, something is wrong in the way I'am 'telling' the clipper menu file
to be aware of the presence of the C.file:

1.
* Clipper menu.prg
external prg.c  && prg.c is a program written in C for which an *.obj has
been
                       && obtained using TCC -c option (i.e. compile only)

do while
..............
set of instructions, including:
 case 'x'
       call _prg.c
...........
endcase

enddo

2. I obtain menu.obj using
   Clipper menu.prg

3. Linking phase:

tlink c0L.obj+menu+...+...+...+Cfile,ei.exe,,clipper+extend+cl >lnk.out

At this point the lnk.out  file bears the

Error: Undefined symbol N_PRIM (my C file.obj) in module EI_UTIL (my Clipper
main menu.obj)

-----------
Could you please tell me where am I wrong?

Thank you for any assistance.

--
Ennio
?There is no limit to man's curiosity
   and willingness to learn?



Thu, 24 Apr 2003 03:00:00 GMT  
 Linking S'87 Clipper files with C files

I have not done this is a long, long time but I am sure I can find the
details.  At the time, TC was version 2 and NOT recommended to be linked
with s87.  MSC 5 (or 5.1?) was the code Clipper was developed with and it
linked to one nice exe.  Most of the third party libs were MSC or ASM.  Some
people were able to get TC to work but...

Let me know if you need me to dig it up.  It was well described in Straley's
book and in Nantucket news.  You might check the Oasis for those old issues.

Mike


Quote:
> Hello to everybody.

> I hope some of the older clipperheads can help me solve this:

> I am trying to link together some S '87 clipper obj files with a simple
> program written in C.
> Both the clipper files and the C prg give perfectly working *.exe files if
> compiled and linked separately (using of course Clipper + Tlink for
Clipper
> files and TCC v. 3.0 for the C file).
> However, if I try to link them in a single *.exe file I get nowhere.
> For sure, something is wrong in the way I'am 'telling' the clipper menu
file
> to be aware of the presence of the C.file:

> 1.
> * Clipper menu.prg
> external prg.c  && prg.c is a program written in C for which an *.obj has
> been
>                        && obtained using TCC -c option (i.e. compile only)

> do while
> ..............
> set of instructions, including:
>  case 'x'
>        call _prg.c
> ...........
> endcase

> enddo

> 2. I obtain menu.obj using
>    Clipper menu.prg

> 3. Linking phase:

> tlink c0L.obj+menu+...+...+...+Cfile,ei.exe,,clipper+extend+cl >lnk.out

> At this point the lnk.out  file bears the

> Error: Undefined symbol N_PRIM (my C file.obj) in module EI_UTIL (my
Clipper
> main menu.obj)

> -----------
> Could you please tell me where am I wrong?

> Thank you for any assistance.

> --
> Ennio
> ?There is no limit to man's curiosity
>    and willingness to learn?



Fri, 25 Apr 2003 03:00:00 GMT  
 Linking S'87 Clipper files with C files

Quote:


> > Hello to everybody.

> > I hope some of the older clipperheads can help me solve this:

> "older" certainly, "help" I don't know...

Thank you, Pete,
for sure it was "help" to me (I did remember the 'run' command, but I
thought it was available for DOS commands only!).

Quote:
> > Both the clipper files and the C prg give perfectly working *.exe files
if
> > compiled and linked separately (using of course Clipper + Tlink for
Clipper
> > files and TCC v. 3.0 for the C file).
> > However, if I try to link them in a single *.exe file I get nowhere.

> That is because they are both "standalone" programs in their
> own right -- if you try to link then together the linker will
> not know which is the _main_ program.

> > For sure, something is wrong in the way I'am 'telling' the clipper menu
file
> > to be aware of the presence of the C.file:

> It depends what you are trying to do -- you could:

> 1. compile/link your C program to a .exe and use eg. RUN in
>    your Clipper app to call/execute it, or

This option works fine: all I needed was to add the run *.exe command in my
Clipper main menu file, i.e.
   case choice=6 && Calculates the first 'n' prime numbers
        run n_prim

Quote:
> 2. make your C code visible to Clipper as a *function* and then
>    call it as you would call any other UDF.

I tried this, including "extend.h" and "nandef.h" (both taken from the
"runlib.zip" you suggested) in the C.file, reorganized as a C.function
called by the Clipper main menu.
Everything seems to go OK, but when I run the single *.exe file I get a
Windows '95 warning of thys type (free translation from Italian):
"The application tried to execute an invalid instruction
  error at location  0000:0017
  activated interrupt: none"

I don't have the necessary knowledge to understand 'exactly' what it means
and to detect was is going on at the given location; but I notice having
gone one step ahead as compared with what happened before: it is no longer
necessary to reboot, i.e., there is an error, but it does not seem to hurt
the PC system all that much!
(By the way, I always fear that by one of these 'experimental trials' one
day I might disrupt everything in my computer....!)

Quote:
> ...... You will find all the information you need in the
> "Extend System" chapter in the S87 manual, but here's a quick
> summary:

Sorry, got all the chapters, except this one!

Quote:
> 1. #include "extend.h" (or <extend.h> depending on your setup)
>    in your C source,

Ok, I did that (see above)

Quote:
> 2. replace the "int main (int argc, char **argv)" with a
>    suitable Clipper function name and declaration.  For example
>    supposing that your C code was some kind of backup/archive
>    function, you might replace the 'main' definition with

If I get it right, these instructions are for the transformation of the
C.prg in a C.function ?

Quote:
>         CLIPPER backup()
>    or
>         void far Pascal backup()

and this is the name simile to be figen to the function (in my case
"n_prifu()"
But is the 'Clipper' in front of it necessary?

Quote:
>    If there are any commandline parameters to your C program,
>    you will have to replace these with calls to the "_par???()"
>    Clipper functions in the code body, and anyway replace the
>    C "return" in 'main' with a "_retni(...)" call.  This stuff
>    is all well documented.  Compile this in large model.

I do not fully understand this, nut there are no parameters in my C
"function"

Quote:
> 3. call your C code from Clipper as you would a UDF, ie.

>         backup()

Ok, I did that ("call _n_prifu()")

Quote:

> I've not tried to link a TCC obj with a S87 application, and
> it is possible that (depending on what TCC lib support you
> need) that it might not work at all -- S87 was written using
> M$ tools so the chances of incompatibilty are high :-(

I fear that it is as you say (see above)

Quote:
> Pete
> --
>         "We have not inherited the earth from our ancestors,
>          we have borrowed it from our descendants."

Anyway, thank you again for you help, Pete.
Even though there is no way to link together the different stuff, the "RUN"
command does do the job. Now I have to discover how to pass to my Clipper
main menu the array (of prime numbers) produced by the C n_prim.exe, and how
to manipulate it.

As a matter of fact I do have a similar program written in Clipper, working
perfectly well which stores the primes into a *.dbf , so that for any
n<already explored n it is not necessary to recalculate. Since I started to
peruse the C language, I discovered that it could produce smaller *.exe
files, so I wanted to make a 'global' smaller *.exe.
But this is a long way............... (Clipper can do finer console jobs:
row(), col(), colors, etc, that I don't think are possible in C).
Ok I hope not to have annoyed you.
Thanks again

--
Ennio
?There is no limit to man's curiosity
   and willingness to learn?



Sat, 26 Apr 2003 08:12:00 GMT  
 Linking S'87 Clipper files with C files

Quote:

> I have not done this is a long, long time but I am sure I can find the
> details.  At the time, TC was version 2 and NOT recommended to be linked
> with s87.  MSC 5 (or 5.1?) was the code Clipper was developed with and it
> linked to one nice exe.  Most of the third party libs were MSC or ASM.
Some
> people were able to get TC to work but...

> Let me know if you need me to dig it up.  It was well described in
Straley's
> book and in Nantucket news.  You might check the Oasis for those old
issues.

> Mike



> > Hello to everybody.

> > I hope some of the older clipperheads can help me solve this:

> > I am trying to link together some S '87 clipper obj files with a simple
> > program written in C.
> > [cut]

Thank you, Mike.
As you can see from my answer to Pete, this is the conclusion I have
reached: that TCC is not apt to do the job!
I should very much appreciate it if you could give me more details and
possibly if and where to find the MSC (Compiler ? : Forgive my ignorance, I
have no technical background).
Best regards

--
Ennio
?There is no limit to man's curiosity
   and willingness to learn?



Sat, 26 Apr 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Help me Link file for clipper summer 87 @ plink86 or tlink

2. btrieve file open from clipper'87

3. Clipper S'87 NG file

4. Clipper '87 Linker delete files!?

5. Clipper (Summer 87) Work Files

6. Need files from Clipper Summer 87 and Rlib 3.0 or 3.0a

7. Clipper Summer 87 files

8. Clipper Summer 87 files

9. Clipper 87 and files

10. Mem files in Clipper Summer 87

11. Reading from COM1: (Clipper S'87 or Clipper 5.2)

12. Clipper Expert (S'87 - Clipper 5.3) needed in Atlanta area

 

 
Powered by phpBB® Forum Software