5.3.7.7 How Do I Make a Function Wrapper For an Assembly Module?

The C compiler expects all C visible names to start with a leading underscore. In order to export a function to C code from assembly code, it must be globally visible. Of course, there should also be an external prototype in C so that the compiler can properly see it.

 foo.s:

      .text
      .global _foo
   _foo: retlw #0,w0

   main.c:
       extern int foo(void);

For details on using C code with an assembly module, see the following section of this user’s guide:

Mixing Assembly Language and C Variables and Functions