Search code examples
c++c++buildergumbo

Gumbo parser in C++ Builder XE6


I'm trying to use the HTML parser - Gumbo (written in C) in my C++ Builder XE6 project.

When I compile, I get many errors (E2140 Declaration is not allowed here etc.), which appear to be coming from the file char_ref.rl.

I've tried a lot to avoid these errors but I didn't succeed.

Has anyone ever used Gumbo in a C++ Builder project, or at least in a C++ project?

Thank you


Solution

  • Note: extern "C" doesn't mean "compile this code as C". It means that the C++ code inside the block should be compiled so that any external names etc. are published in a way compatible with the C ABI. And such a block shouldn't include any function definitions. You may be using extern "C" incorrectly in your code but it's hard to say without seeing your code.

    Anyway, the C compiler part of bcc32.exe doesn't seem to allow mixed statements and declarations, even if you give the flag -An which is supposed to mean "Use C99 keywords and extensions".

    You will have to either do a 64-bit build or make a whole bunch of changes to this C source for compatibility with the dinosaur that is bcc32. Or you could build Gumbo as a DLL with a modern compiler (if it supports that option, IDK).