Using c code in Symbian

xiaoxiao2021-03-06  40

Calling the c function in C file (porting)

1.

Create a header file (.h) for your "c" Program. The Contents of the Header File Will Look Like

#ifdef __cplusplus

Extern "C" {

#ENDIF

// Functions this you go for call in

C

Void yourfunction ();

Void PrintFMessage ();

int SUM (INT I, INT J);

......

......

......

#ifdef __cplusplus

}

#ENDIF

2:

Now create your related ".c" file which includes all the function's definitions which are declared in the above ".h" files. If required As well other ".c" file whose functions will be called by ".c" functions. For Instance, Sum () Will Call GetFirstNumber () That IN Another ".c" file.

3:

Now you have to edit the mmp file. A) Add the filename

Source

b) Add stdlib's header.

Syteminclude / EPOC32 / Include / Libc

c) The import library estlib.lib is The c standard library.

Library Estlib.lib

4:

Call yourFunction (); from C File. This C File Should Have the ".h" of the "c" file.

5:

This is Only for Console Based, Rest of The Steps Are Same. For, Console Based Application (I.E., for .exe) The Project Also Links To ECRT0.LIB. This file provides the e32main () entrypoint for a ".exe"

Staticlibrary ECRT0.LIB

转载请注明原文地址:https://www.9cbs.com/read-74708.html

New Post(0)