emx libs -- Strings with GPC for EMX_(re)

Tue, 28 Nov 1995 14:46:25 -0500


Peter Gerwinski wrote:
> 
> Hello Thomas Dunbar, hello GPC-list!
> 
> I can reproduce your error concerning strings with GPC for EMX:
> 
> > when i compile:
> >
> > program t(input,output);
> > type
> >   s1=string(10);
> > var
> >   s:s1;
> > begin
> >  readln(s);
> >  writeln(substr(s,2,3));
> > end.
> >
> > with gpc on solaris or linux, it compiles fine. when i compile
> > with emxgpc, i get:
> >
> > ...   (error messages)
> 
> The error comes from a wrong cooperation between GPC and GCC:
> Each of both thinks that it is job of the other one to implement
> the function __gcc_bcmp.  Perhaps a recompile of GPC for EMX would
> solve the problem, but here is how you can get around the error:
> Just write a small file  gcc_bcmp.c  which contains the following:
> 
> /* __gcc_bcmp function */
> 
> /* Like bcmp except the sign is meaningful.
>    Result is negative if S1 is less than S2,
>    positive if S1 is greater, 0 if S1 and S2 are equal.  */
> 
> typedef int size_t;
> 
> int
> __gcc_bcmp (s1, s2, size)
>      unsigned char *s1, *s2;
>      size_t size;
> {
>   while (size > 0)
>     {
>       unsigned char c1 = *s1++, c2 = *s2++;
>       if (c1 != c2)
>         return c1 - c2;
>       size--;
>     }
>   return 0;
> }
> 

thanks, that works (once i downloaded the dos gcc stuff)

so for now, i'm just having my students (high school pascal course)
use:

  gpc t.pas bcmp.o

(they're using 4meg boxes with little free disk space :(
not even room for gcc, really.  what i'd really like is to have 
them run linux but that would be _too_ much and not enough disk free
anyway...)

but iguess now's as good a time as any to show them some C code, too.

> (I found it in the file  libgcc2.c  from the gcc-2.6.3 source.)
> Include it into the compile, e.g.:
> 
>   gpc myfile.pas gcc_bcmp.c
> 
> A more elegant way would be to include the missing routine into
> gpc.lib for EMX.  (But I don't know how to do this :-).
> 
> This problem will probably be fixed in my next release of GPC-EMX
> binaries.

thanks,
  thomas

> 
> Yours,
> 
>     Peter
> 
> --------------------------------------------------------------------------------
> Dipl. Phys. Peter Gerwinski
> Fachbereich Physik
> Universitaet-GH Essen                   Phone:  +49-201-183-2763
> D-45117 Essen                           Fax:    +49-201-183-2120
> Germany                                 e-mail: pege@mail.theo-phys.uni-essen.de
> --------------------------------------------------------------------------------

-- 
Thomas Dunbar    540 231-3938 (fax 3714)   http://gserver.grads.vt.edu/


Thomas Dunbar (tdunbar@gserver.grads.vt.edu)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es