extern "C" int func(int *, Foo);
This is from a sample code from class. But I don’t understand how the interface is working, one with no variable name, the other with no type. How is that going to work?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When declaring functions you don’t need to specify a parameter name, just a type.
Fooin this case is a type.extern "C"tells the compiler it should use a C-style symbol, which more or less means it won’t be using name mangling (which C++ uses to allow multiple functions share a name, but use different parameter sets or namespaces).