C ++ extern - "C" for languages ​​other than C

As you know, declaring a function extern "C"in C ++ makes its C name coherent, which allows you to use C code.

My question is: are there other programming languages ​​with which you can associate C ++ function names, for example, extern "Lisp"or extern "FORTRAN"?

If not, why? What is the internal structure "C"that makes the constraints?

What are the alternatives?

+4
source share
1 answer

The C ++ Standard, 7.5.2 dcl.link, says:

Binding between fragments of C ++ and non-C ++ code can be achieved using the Link specification:

linkage-specification:
    extern string-literal { declaration-seqopt}
    extern string-literal declaration

. "C" "++". , "C" "++", , , . [ : , , . -end note] [ . , . , ( ADA) Fortran FORTRAN, . -end note]

, , , C ++.

C- . , interop , C, C-. , C ++.

+2

Source: https://habr.com/ru/post/1524737/


All Articles