I have some c functions that I would like to import into a CROSS PLATFORM compatible Swift package. It’s only a function from each of these files (fcntl.h, unistd.h, sys/socket.h, netinet/in.h).
Is there a recommended way to do this?
I was thinking of something like:
Create my wrapper functions:
int swift_fcntl(int fildes, int cmd, int arg){
return fcntl(fildes, cmd, arg);
}
int swift_close(int fd){
return close(fd);
}
uint16_t swift_htons(uint16_t portNum){
return htons(portNum);
}
Use a build script to build the library and copy it /usr/local/lib and /usr/local/include
Use the module map file to import the static lib