# Embedding an extension

**URL:** <https://www.ruby-forum.com/t/embedding-an-extension/174435>\
**Category:** Ruby\
**Created:** [August 26, 2009, 6:33pm UTC](https://www.ruby-forum.com/t/embedding-an-extension/174435 "2009-08-26T18:33:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mon\_ouie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@mon\_ouie](https://www.ruby-forum.com/u/mon_ouie)\
**Post date:** [August 26, 2009, 6:33pm UTC](https://www.ruby-forum.com/t/embedding-an-extension/174435/1 "2009-08-26T18:33:54Z")

</div>

Hi,

I’m using Ruby on the PSP ( a patch has been posted here ;). Now, I’d  
like to add the socket support to my application. Since there already is  
a socket extension, I shouldn’t create mine, should I ?

The problem is that, on the PSP, I can’t use shared object. So I thought  
the best way was to compile the socket extension with mine, and to call  
“InitSocket()” in my main function. So I tried to add the defines in my  
Makefile manually :  
CFLAGS +=-DHAVE\_UNISTD\_H -DHAVE\_NETINET\_TCP\_H   
-DHAVE\_SYS\_SELECT\_H -DHAVE\_SYS\_TYPES\_H -DHAVE\_SYS\_TIME\_H  
-DHAVE\_FCNTL\_H   
-DHAVE\_ARPA\_INET\_H -D\_FILE\_OFFSET\_BITS=64 -DHAVE\_SOCKADDR\_STORAGE   
-DHAVE\_SOCKET\_H -DHAVE\_SENDMSG -DHAVE\_RECVMSG -DHAVE\_ST\_MSG\_CONTROL   
-DHAVE\_GETNAMEINFO -DHAVE\_TYPE\_SOCKLEN\_T -DHAVE\_SOCKET   
-DHAVE\_GETHOSTNAME -DHAVE\_GETHOSTBYNAME2 -DHAVE\_FNCTL

However… well… it doesn’t compile yet.  
socket/socket.c:1446: erreur: storage size of â€˜fromâ€™ isnâ€™t known  
socket/socket.c:1446: attention : unused variable â€˜fromâ€™

same for each uses of “struct sockaddr\_storage”. Does anyone know what I  
should change in my CFLAGS ( or even in socket.c ) ?

Thanks in advance.
