user1277478
user1277478

Reputation: 1

Calling C functions from Objective-C (references and default parameters)

Is it possible to include a C header file for a dylib into an Objective-C project when the functions for the dylib include references and default parameters. For example

extern "C" {
unit32_t GetThisReference(uint32_t & theRef);
unit32_t ThisFunctionHasDefaults(uint32_t aparm, uint32_t one = 1, uint32_t two = 2);
};

Thanks!

Upvotes: 0

Views: 153

Answers (2)

Matt Wilding
Matt Wilding

Reputation: 20163

References and default parameters are features of C++, not C. You could try compiling the file as Objective C++ (by changing the extension to .mm).

Upvotes: 4

MrMage
MrMage

Reputation: 7486

Including C libraries is straightforward as Objective C is merely a superset of plain C. But as far as I know, C functions do not have default values. Are you sure that you don't mean a C++ library? In that case, you may want to call the library functions from an Objective-C++ file.

Upvotes: 1

Related Questions