[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-Modules] Building XS based modules



ssize_t came out with the 1990 POSIX.1 standard. Where size_t represents th=
e 
_unsigned_ size of things, ssize_t is a _signed_ primitive system data type=
=20
and represents the return value of functions that return a count of bytes,=
=20
like 'read' and 'write'.

Both 'read' and 'write' return -1 on error, so the size_t (as opposed to=20
size_t) is necessary.

For a machine-specific hack it might be better to dive into the sys/types.h=
=20
file that you've got kicking around, find the actual typedef for ssize_t,=
=20
and use that.

To answer the other implied question, as long as you're aware of the=20
difference there are any number of XS projects that will compile just fine=
=20
with your fix and that will not be affected, obviously. Just so long as you=
=20
never have any code with read's and write's that fail. :-)

Arved Sandstrom

At 10:26 AM 3/14/00 -0500, Adam Witney wrote:
>Hello,
>
>I have recently been looking at XS files and how to build shared=20
>libraries. I followed with interest the recent discussion lead by=20
>Fran=E7ois LETELLIER. And have been reading the tutorial By Arved 
>Sandstrom.
>
>I am using CW IDE and I started by trying to build the XS example in=20
>the back of the MPPE book.. that is XPlusX.
>
>I encountered similar problems to Fran=E7ois with regard to lots of 
>redefinitions in the sfio header files. I then found a more recent (I=20
>think!) version of sfio on Matthias Neeracher's website (*see below).=20
>Using this version in place of the MacPerl source distribution of=20
>sfio fixed all the redefinition errors.... however it came up with=20
>some new errors of its own... specifically an illegal type, ssize_t.=20
>I am pretty new to C and have only come across a size_t type so not=20
>knowing if this was correct and in true newbie fashion (!!) i=20
>replaced all of these in the new sfio.h file with size_t ....and it=20
>compiled. I created the shared library with make, and low and behold=20
>my XPlusX module now worked!! yeah... my first module build!
>
>Anyway, the reason for my post is firstly, was I right to replace the=20
>ssize_t types with size_t in the sfio.h? or will this cause me=20
>problems later on. And secondly that this experience may be useful to=20
>someone else who is just starting out in this.
>
>thanks
>
>adam
>
>
>
>* address of the newer sfio
>ftp://sunsite.cnlab-switch.ch/software/platform/macos/src/mw_c/sfio_04=20
>Aug99.sit.bin
>
>
>=3D=3D=3D=3D Want to unsubscribe from this list?
>=3D=3D=3D=3D Send mail with body "unsubscribe" to macperl-modules-request@=
macperl.org
>
>


=3D=3D=3D=3D Want to unsubscribe from this list?
=3D=3D=3D=3D Send mail with body "unsubscribe" to macperl-modules-request@m=
acperl.org