Clipper/C Problem

Mark W. Schumann catfood at NCoast.ORG
Mon Dec 24 09:11:39 AEST 1990


dgrimmer at ciss.Dayton.NCR.COM (Dave.Grimmer at Dayton.NCR.COM) writes:
>I am using Clipper 87 and MS C 5.10 to try to do some trig functions.
>The programs and command lines used to link them are shown below.  
>Basically, the problem is that I get an unresolved external refference
>to "_cos" in a program that try to do a cosine function.  I probably 
>have missed something simple.  If you have any experience interfacing
>Clipper and MS C, please look at this simple problem and let me know
>what I have missed.  Any help would be appreciated...

>CLIPPER djgcos()
>{
>   double i;
>   i=_parnd(1);
>   _retnd(cos(i / 57.29578));
>}

>LINK WITH MS LINK 3.65
>----------------------
>link /NOE test.obj djgcos.obj ,,, \clipper\clipper

>RESULTS:
>-------
>LINK : error L2029: Unresolved externals:
>_cos in file(s):
> DJGCOS.OBJ(djgcos.c)

Your C function simply does some setup and calls the function named
cos() that should be in one of the Microsoft C libraries.  But you're
only linking in CLIPPER.LIB.  (By the way, most C compilers stick a
leading underscore in front of function names; this doesn't have a
whole lot to do with your problem.)

Try linking in whatever MSC library contains cos().  That might give
you a different linker error because cos() itself may call functions
that are assumed to be in the MSC startup code.  In that case you
might want to go really crazy and tinker with the startup code or
write your own cos().

In general, it is not as easy as it looks to interface C and Clipper
when your C requires the use of library functions.

I hope this helps a little.
-- 
============================================================
Mark W. Schumann  3111 Mapledale Avenue, Cleveland 44109 USA
Domain: catfood at ncoast.org
UUCP:   ...!mailrus!usenet.ins.cwru.edu!ncoast!catfood



More information about the Comp.lang.c mailing list