Re: extern "C" From command line

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

 



Seyran Avanesyan wrote:

> The functions are going to be exported from a Dll, which is going to be
> done using MinGW. Is that still requires that client of that Dll be
> compiled with MinGW?

If they have C++ linkage then they need to be called with a C++ compiler
with compatible ABI.  If you want to mix compilers with different C++
ABIs (such as gcc and MSVC) then you need to use C linkage.

> The problem is I need to MinGW compile a Dll as C++ not as C, and call
> exported functions from MSVC compiled application.

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"
}

Brian

[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