Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

dhcp_set_hostname () and C++

I tried to use the dhcp_set_hostname() function but the linker complained that it couldn't find that function. I used it in a file that is compiled as C++. I found that the solution was to edit the dhcp.h file provided with ecos to change this code:

// Set hostname to be used with the DHCP TAG_HOST_NAME option.

// Call this before calling init_all_network_interfaces() to

// set the hostname value.# ifdef CYGOPT_NET_DHCP_OPTION_HOST_NAME

extern void dhcp_set_hostname(char *hostname); # else# define dhcp_set_hostname(hostname) CYG_EMPTY_STATEMENT# endif

into this:

// Set hostname to be used with the DHCP TAG_HOST_NAME option.

// Call this before calling init_all_network_interfaces() to

// set the hostname value.# ifdef CYGOPT_NET_DHCP_OPTION_HOST_NAME

externC void dhcp_set_hostname(char *hostname); # else# define dhcp_set_hostname(hostname) CYG_EMPTY_STATEMENT# endif

The difference is that I changed extern to externC. I'd rather not edit the ecos source code, so is there another way I could make this work?

Mike
No RepliesBe the first to reply