cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Cross-compiling libcurl for an embedded platform using lwip

From: Mason <mpeg.blue_at_free.fr>
Date: Wed, 29 Feb 2012 11:17:07 +0100

Gisle Vanem wrote:

> Dan Fandrich wrote:
>
>> curl very much expects a BSD-style socket library. The best bet is to
>> write a shim library that calls the LWIP socket functions using the
>> standard names so that configure can find them.
>
> lwIP already has this shim built-in.
> Ref. src/include/lwip/sockets.h:
>
> #if LWIP_COMPAT_SOCKETS
> #define accept(a,b,c) lwip_accept(a,b,c)
> #define bind(a,b,c) lwip_bind(a,b,c)
> #define shutdown(a,b) lwip_shutdown(a,b)
> #define closesocket(s) lwip_close(s)

This only provides source-code compatibility.

Consider

$ sh-superh-elf-nm --defined-only sockets.o
00000568 t _alloc_socket
00000000 r _err_to_errno_table
00000608 t _event_callback
00000000 t _get_socket
000007e4 T _lwip_accept
000009e0 T _lwip_bind
00000aa0 T _lwip_close
00000b70 T _lwip_connect
00001944 T _lwip_fcntl
00000318 t _lwip_getaddrname
00001684 T _lwip_getpeername
00001690 T _lwip_getsockname
0000169c T _lwip_getsockopt
00000188 t _lwip_getsockopt_internal
000018e8 T _lwip_ioctl
00000c30 T _lwip_listen
00000f72 T _lwip_read
00000f90 T _lwip_recv
00000ca8 T _lwip_recvfrom
00001278 T _lwip_select
000003b4 t _lwip_selscan
00001138 T _lwip_send
00000fac T _lwip_sendto
000017d0 T _lwip_setsockopt
00000048 t _lwip_setsockopt_internal
000015f4 T _lwip_shutdown
000011dc T _lwip_socket
000007e0 T _lwip_socket_init
0000126c T _lwip_write
00000064 b _select_cb_ctr
00000060 b _select_cb_list
00000000 b _sockets
00000024 t _tryget_socket

$ sh-superh-elf-nm --defined-only netdb.o
00000004 C _h_errno
00000124 T _lwip_freeaddrinfo
00000148 T _lwip_getaddrinfo
00000000 T _lwip_gethostbyname
00000060 T _lwip_gethostbyname_r
0000000c b _s_aliases.3917
00000010 b _s_hostent.3916
00000008 b _s_hostent_addr.3918
00000000 b _s_phostent_addr.3919

With some linker magic, I could probably alias foo to lwip_foo.
Would that be a good idea?

-- 
Regards.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-02-29