Calling C Functions from Objective-C

As Objective-C is a superset of C, it allows developers to mix pure c source files with Object-C source files.

But to call a C function from Objective-C, you should not import the .c file in your Objective-C .m file, that won’t work.

To call a C function from the Objective-C, you need to create a .h header file to include the C function declaration, and, of cause, include the .h file in the .c source file where the C function resides. Then import the .h file in the .m source file where you would like to call the C function, and simply call the function.

  1. […] Calling C Functions from Objective-C | Langui […]

  2. Thanks bro! Worked perfectly

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.