首 页 | 新 闻 | Symbian | Android| Windows Mobile | J2ME | 下载中心 | 游戏策划招聘与求职 | 购书指南 | 视频教程
您现在的位置: 开发视界 >> Symbian英文资料 >> base >> 正文
Using C code in symbian
作者:佚名    文章来源:不详    更新时间:2006-5-7 10:57:38

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 that you going to 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 is 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

相关文章:
How to reset the alternate makmake entry in Codewarrior
Carbide.vs - Disabling the MMP/PKG File update feature
Codewarrior: how to avoid the "Too Many Include Paths" error when using the UIQ 2.1 SDK
Carbide.c++: Setting up On Target Debugging
Using Extended Notifiers
Display the extended panic code in Emulator or Device
Start automatically an application or an exe after its installation
Compress Your Symbian C++ Executables
 

站点地图 | 加入收藏 | 联系站长 | 广告服务 |
QQ:280529124  Tel:0592-8271361 辽ICP备05021703号