How do we choose between bsdsocket.library's functions and newlib's?

3 posts / 0 new
Last post
Hans
Hans's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 2010-12-09 22:04
How do we choose between bsdsocket.library's functions and newlib's?

How do we choose between bsdsocket.library's functions and newlib's? Given that most of the functions are the same, how do we tell the compiler to choose one over the other?

I've got some networking code, but currently can't even tell whether it's via newlib or bsdsocket.library. It matters which one, because AmiSSL can only be used with file descriptors from bsdsocket.library.

Hans

broadblues
broadblues's picture
Offline
Last seen: 4 years 10 months ago
Joined: 2012-05-02 21:48
Re: How do we choose between bsdsocket.library's functions...

If you are coding on AmigaOS4 and don't require backwards compatabilty the easiest solution is to use the interface.

ie

definetly bsdsocket

ISocket->connect()

Otherwise it's being careful about how you order your includes.

Just adding

#include <proto/bsdsocket.h>

Should be enough in most cases as that wil pull in the inlines and those will replace the functions call with macros referenceing ISocket or SocketBase depending on the target (AmigaOS4 or 68k).

It's little easier to be certain with clib2 as there is a separate libnet.a so not linking against that will give erreors if you messed up your inlcudes.

Hans
Hans's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 2010-12-09 22:04
Re: How do we choose between bsdsocket.library's functions...

Thanks.

This code needs to be cross-platform, so I'll try the second option.

Hans

Join the Kea Campus - upgrade your skills; support my work; enjoy the Amiga corner.
https://keasigmadelta.com/ - see more of my work

Log in or register to post comments