将c ++代码从Unix移植到Wince的过程 [英] Procees of porting a c++ Code from Unix to Wince

查看:91
本文介绍了将c ++代码从Unix移植到Wince的过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好老年人,

我是新手.我只是想问我们如何将Linux的C ++代码移植到Wince的C ++代码.
我们是否只需要替换头文件和库函数即可?
如果是,有人可以给我提供一个链接,该链接指定wince中用于Unix代码的后续头文件..
请回答

Hello seniors,

I am new to porting. I just wanted to ask that how should we proceed porting of a c++ code for Linux to a C++ code for wince.
Do we need to just replace the header files and the library functions to do so?
If yes can somebody provide me with a link that specifies the subsequent header file in wince for unix code..
Plz reply

推荐答案

恕我直言,您要问的是正确与错误同时......

让我解释一下:
我们是否需要替换头文件和库函数?
是的,您需要更改与操作系统交互的任何内容,如果应用程序中有任何对象,则主要是要对图形对象起作用的功能.

如果可以,有人可以给我提供一个链接,该链接指定wince中用于Unix代码的后续头文件..
好吧,不,您可能需要更改大量功能,并将它们汇总在一个链接中……对我来说似乎非常困难...

我以前从未做过,但是一个小的google搜索给了我很多结果(主要是从Windows到linux,而不是您感兴趣的结果),但是在所有情况下,约束和细节都是不同的.如果要使用套接字,窗口...,您将有不同的需求...

我认为您的问题将是耐心和良好的设计能力:检查不是100%兼容的内容,并尝试确定应使用哪些功能和库.还有大量的编译时间.

祝您好运.
IMHO What you are asking is correct and incorrect at the same time...

Let me explain:
Do we need to just replace the header files and the library functions to do so?
Yes, you will need to change whatever is interacting with the OS, mainly functions that are working towards the graphical objects if there are any in your app.

If yes can somebody provide me with a link that specifies the subsequent header file in wince for unix code..
Well, no, there can be tons of functions that you will need to change, summarizing them in one link... seems extremely difficult to me...

I''ve never done that before but a small google search has given me tons of results (mostly from windows to linux and not what you are interested in) but in all the cases the constraints and specifics are different. If you are working with sockets, windows, ... you will have different needs...

I think your problem here will be a matter of patience and good design habilities: checking what is not 100% compatible and trying to figure out which functions and libraries you should use. And a good amount of compiling time.

Good luck with that.


如果您的项目很小,并且您不打算将来将其移植到其他平台,那么它的工作方式就像您在问题中提到的那样.如果要通过使其与Linux兼容来移植代码,或者将来希望将其移植到许多其他平台上,则应该这样做:首先,只需重构Linux程序.您应该通过在程序的跨平台和平台无关的部分之间放置跨平台接口来做到这一点.您可以一步一步完成此操作,并且始终可以测试linux程序是否仍然有效.整个移植到一个大程序中,然后避免出现太多崩溃不是一个好策略.创建跨平台接口(如ISocket,IFilesystem,IFileStream等)后,您可以在其他平台上编写这些接口的平台相关实现.您仍然可能会犯很多错误,并且可能是编写大量代码的原因,但是您可以为每个接口编写小型测试,并且至少可以肯定代码的跨平台部分是可操作的,因为您已经在旧版本上对其进行了测试平台,同时介绍接口.从任何平台迁移到任何其他平台都是如此.仅当我们在谈论诸如套接字之类的特定库时,才将诸如linux之类的平台指定为WinCe可能是有意义的,但是即使在那种情况下,它也不总是很重要.可能使移植变得困难的另一件事是不同的硬件限制(较慢的cpu,更少的内存等),但是在相对简单的程序无法突破硬件限制的情况下,这并不那么重要.在硬件限制的情况下,有时您必须在程序中使用完全不同的体系结构解决方案.但同样,如果是普通用户,则不是这种情况.
If your project is small and you are not planning to port it to other platforms in the future then it works like you mentioned in your question. If you want to port your code by keeping it linux compatible and maybe you want to port it to a lot of other platforms in the future then you should do it like this: First just refactorize the linux program. You should do that by putting crossplatform interfaces between the crossplatform and platform independent part of your program. You can do that in small steps and you can always test if the linux program still works or not. Making the whole porting in a big program and then parying for not too many crashes is not a good strategy. After creating the crossplatform interfaces (like ISocket, IFilesystem, IFileStream, ...) you can write the platform dependent implementation of these interfaces on the other platform. you can still make a lot of bugs and it might be a big piece of code to write, but you can write small tests for each interfaces and at least the crossplatform part of your code is operable for sure because you already tested it on the old platform while you were introducing the interfaces. This is true for proting from any platform to any other platform. It might make sense to specify platforms like linux to WinCe only if we are talking about a specific library like sockets, but it isnt always important even in those cases. Another thing that can make porting hard is different hardware limitations (slower cpu, less memory, ...), but in case of relatively simple programs that dont push the limits of the hardware this isnt so important. In case of hardware limitations sometimes you have to use totally different architectural solutions in your program. But again, in case of general user progs this isnt the case.


这篇关于将c ++代码从Unix移植到Wince的过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆