开发者

moving code from unix to windows xp

i have code written in c++. its a console app that takes an input and displays output. Now i can just give my a.out to someone without giving them the code and it should work on another unix system. but what if they have windows environment. I would like to learn how to make dll for them so they can run that.

also, if they were going to use it as part of another program I guess i would need to make an api or function for them. But i am not sure how开发者_如何学Python that works with dlls as i have never done this before.


Now i can just give my a.out to someone without giving them the code and it should work on another unix system.

No it shouldn't and almost certainly won't. Executables are not typically portable across even closely related operating systems, and most flavours of Unix are not too closely related. You need to compile your application for the specific (and "unix" is not specific enough) target OSs you are interested in.


You need to recompile your application for Windows, either on a Windows machine or by using a crosscompiler. This requires that all routines which you use need to be available under Windows, too.

Either you wrote your application from scratch using portable libraries (read: no unix/posix system calls), or you will get problems porting your code to run under Windows. Cygwin can probably help, check it out.

If you say its a pure console app, I assume you're using std::cout and std::cin or other stuff from the C++ standard library. These are indeed universally available on every C++ implementation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜