- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I was wondering if there comes an C++ example for the lightweight ip stack with NIOSII ? I only see c examples, but if i want to extend them with C++ it won't work because of the differences in C and C++. Ofcourse i can change the code to work with C++ but if there is a specific example i like too know, Thanks in advance, jmastron.Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There should be no problem with calling the LWIP C functions from C++. The only thing you have to ensure is that function prototypes are declared to be external C functions.
The easiest way to do this is to wrap the include for the LWIP files in an extern "C" decleration, e.g.: extern "C" {# include "lwip/sys.h"# include "lwip/netif.h"# include "lwip/sockets.h" }; Other than that, everything should work fine.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, I know that I should use extern "C".
I only wants to have an working C++ example for the lwip module, because the given examples are in C, and it is not so easy to convert them to C++ (I tried, but didn't get it working). Adding "extern "C"" isn't enough. Thanks anyway, Michel.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page