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

Tue, 28 Nov 1995 19:57:35 +0100 (MEZ)


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;
}


(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.

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
--------------------------------------------------------------------------------


Peter Gerwinski (pege@rs1.Theo-Phys.Uni-Essen.DE)

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