Hi, As long as a function is declared with a C link interface by using extern it can be called from C. It can be implemented in C++, but then of course must be compiled by a C++ compiler, and have a C++ extension such as .cpp.
Atgeirr 21. feb. 2014 kl. 14:09 skrev Markus Blatt <[email protected]>: > Hi, > > On Fri, Feb 21, 2014 at 01:08:29PM +0100, Andreas Lauser wrote: >> On Friday 21 February 2014 12:48:36 Markus Blatt wrote: >>> Seeing the >>> >>> #ifdef __cplusplus >>> extern "C" { >>> #endif >>> >>> statements. Are some you compiling opm-core with C? Or is it always >>> compiled with a C++ compiler and just some parts of the library must >>> be usable from C? >> >> If I'm not horribly wrong, everybody who does nothing special to their build >> uses the C compiler for those parts: >> >> -- snip -- >> and@heuristix:~/src/opm-core > make VERBOSE=1 >> ... >> [ 4%] Building C object >> CMakeFiles/opmcore.dir/opm/core/grid/cpgpreprocess/uniquepoints.c.o >> /usr/bin/cc ... >> ... >> -- snap -- >> >> hope that helps... > > Just found that out, too. Is that really necessary or should extern C > be enough to make them usable from C? I would hate to duplicate code. > > Markus > > > -- > Dr. Markus Blatt - HPC-Simulation-Software & Services http://www.dr-blatt.de > Hans-Bunte-Str. 8-10, 69123 Heidelberg, Germany, USt-Id: DE279960836 > Tel.: +49 (0) 160 97590858 > _______________________________________________ > Opm mailing list > [email protected] > http://www.opm-project.org/mailman/listinfo/opm _______________________________________________ Opm mailing list [email protected] http://www.opm-project.org/mailman/listinfo/opm
