Talk about porting

原创 2007年09月13日 14:44:00
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:
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



Notes about Porting suspend-to-disk function to android

porting suspend-to-disk email: 1. suspend-to-disk introduce It is exciting to...
  • rex_nie
  • rex_nie
  • 2013年06月09日 22:24
  • 3083

Let's talk about ReactiveCocoa

  • 2017年02月21日 18:38
  • 456KB
  • 下载

talk about approach

  • 2009年03月30日 13:12
  • 98KB
  • 下载


  • char_c
  • char_c
  • 2017年04月21日 20:21
  • 123


  • lslxdx
  • lslxdx
  • 2011年09月29日 22:36
  • 418

something talk about lock from FreeBSD mail list

On Sat, 11 Apr 2009, Andrew Brampton wrote: I'm having a problem with memguard(9) on FreeBSD 7.1 bu...


(一)静心不静   1、静心。   学习的过程,是一个漫长而枯燥的过程,学习者必须要有吃苦耐劳的准备,静下心来,从大家的视觉中消失,经受一个长时间的编程学生过程。吃尽苦中苦,方成人上人!等...

11月9日 Meetup and talk about JS

"Hot Code Replacing" in Webpack by ChenYong. "How to write a React-Native Module" by Xeodu Li.

nike tn officiel they began to talk about his family

,nike tn officiel according to the rules of their home, at least give help benefactor knock three r...
您举报文章:Talk about porting