Description of Problem: We are interfacing to the TCP/IP stack with our powerline code. Powerline is effectlivly an ethernet device. We are doing some reimplementation work and moving some of the code from C to C++. This is now causing a problem because g++ compiling C code does something different to what gcc does when compiling C code. We need the file mbuf.h for some of the definitions that are in it. We tell g++ to compile this bit with C semantics since its a C header file. The header file declares some variables (bad idea). gcc marks these variables as common, aka 'C' according to nm. g++ makes them unintialised data, aka 'B' in nm. The linker can handle multiple 'C' variables and it discards all but one. Multiple 'B' variables is cannot handle. Reading http://gcc.gnu.org/ml/gcc/1999-05n/msg00511.html suggests this is the correct thing to do.... So, mbuf.h need to be hacked so that it does not declare variables...... Version-Release number of selected component (if applicable): 1.5.2
Created attachment 45420 [details] This patch seems to fix it for us. Its not had much testing.....
Looks like Andrew mixed up declaration and definition very consistently (even in the patch) :-) So everywhere you read "declaration" above, it should be "definition" and vice versa.
I've applied something pretty similar to your patch, so it should show up in future releases.
Jonathan, your change isn't visible in the public eCos CVS yet, so I can't check what exactly you applied. Andrew's patch added "#endif __ECOS" both in include/sys/mbuf.h and src/sys/kern/uipc_mbuf.c and gcc 3 complains about that. If you applied that patch directly, could change it to either just "#endif" or to "#endif /* __ECOS */"?
Yep, don't worry. I had already caught that :-).