Talk about porting

 
I started to use wince, and try to understand the difference between win32 pc platform and the wince mobile platform. In this article I begin to introduce how to refactor your codes in order to make them more reusable and easy porting; first, introduce the general concept and principle; second, I try to take an example to introduce how to porting the win32 pc program into wince (I use Windows Mobile 5 Pocket PC Emulator) program.
 
The Main concept and principle should be: analyze the code architecture; try split the platform dependent and platform independent code, which contains the “Divide and conquer” philosophy. Try to abstract the platform dependent code into the general INTERFACEs, so that when porting to different platform, you just concern about these INTERFACEs, we just need to implement these INTERFACEs, who can ensure our program work. Note that the platform dependent code could be appeared in the following modules:
a)        Graphic rendering mechanism. If it is a tool, or a utility, and which has GUI, then you need to know which UI framework or library to take, if neither, you maybe manage your GUI module with your own code.
b)        Sound rendering mechanism, maybe you need encapsulate a module especially for sound rendering, I have known about one portable-audio library called portable cross-platform Audio API , currently its latest version is V19, you can reference this link: http://www.portaudio.com
c)         Interactive things, such as key, mouse event, etc
d)        Assembly code rewrite if platform’s CPU instruction set is un-compatible
e)        Task/Thread related Interface should be taken care if you want to move you code to a different platform. Task or thread is tightly related with the OS of the platform, but if you want to make the program more reusable to other platform, you could pay more attention to this area, or simply, you can write an OS-Independent Wrapper, maybe you know RTP (Real-time Transport Protocol), and there is a good RTP implementation (Compatible with RFC 3550) called jrtplib, the author is Jori Liesenborgs, who encapsulates the Win32 thread mode and Linux/Unix’s pThread mode into the JThread, which is just a wrapper, simple but effective, anyway, almost erveryone like simple things.

(To be cont...) 

@ 20070913

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值