Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

dhcp_set_hostname () and C++

Altera_Forum
Honored Contributor II
1,191 Views

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
0 Kudos
0 Replies
Reply