RE: extern "C" From command line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Then you need C linkage, which means you have no choice but to enclose
> the code in "extern C" (or compile it with a C compiler of course.)
If
> you really can't modify the source.cpp file then I still don't see why
> you can't do something like:
> 
> extern "C" {
> #include "source.cpp"
> }

Well, I can't do that because source.cpp allowed to contain #include-s.
(Of course I can parse source.cpp and create modified_source.cpp. Just
need to preprocess, then use yacc/lex or Spirit C-grammar parser...)

I can also write my own, simplified grammar parser for source.cpp (since
source.cpp is using C syntax).

But I just tried to compile with "-x c++" with extern "C" in souce.cpp
(experimentally added that manually), and when I tried to call it from
MSVC app I've got a crash.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux