I'm very blocked because I would like to porting a C code (running in Linux) to windows and I don't know how I could do this, the code has the following libraries:
我被屏蔽了,因为我想把一个C代码(在Linux中运行)移植到windows上,我不知道该怎么做,这个代码有以下库:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "openssl/conf.h"
#include "openssl/evp.h"
#include "openssl/err.h"
#include <my_global.h>
#include <mysql.h>
#include <m_string.h>
What I can do to port this code to Windows(running in 32 and 64)?, thank you
如何将该代码移植到Windows(在32和64中运行)?,谢谢你
2 个解决方案
#1
3
There's no "magical wand" or "easy way" to do it.
没有什么“魔法棒”或“简单的方法”可以做到。
If your code is not 100% POSIX-compliant (and as far as I know Windows doesn't support that terribly well), your code is not going to run on Windows without emulation or rewriting it.
如果您的代码不是100%兼容posix(据我所知,Windows不太支持posix),那么您的代码在没有模拟或重写的情况下不会在Windows上运行。
You might try:
你可以试一试:
- http://www.cygwin.com/ - recompile your application with this
- http://www.cygwin.com/ -用这个重新编译你的应用程序
- A virtual machine on Windows
- Windows上的虚拟机
- See if a ported version of your sw exists
- 看看你的sw是否存在一个移植版本
- coLinux stuff (http://sourceforge.net/projects/portableubuntu/) - 32 bit only
- coLinux stuff (http://sourceforge.net/projects/portableubuntu/) - 32位
- Rewrite your app for Windows
- 为Windows重写应用程序
From the above, some headers might be replaced with equivalent ones (hopefully), e.g. try io.h
for some of the POSIX functionalities.. then you'll have to port linux sockets to Windows ones (and that's a relatively easy task). Openssl is multi-platform so no problem..
在上面,一些头可能被替换为等价的(希望),例如:try io。h表示一些POSIX函数。然后,您将不得不将linux套接字移植到Windows操作系统(这是一个相对简单的任务)。Openssl是多平台的,所以没有问题。
I don't know what my_global
and m_string
are, sorry.
我不知道my_global和m_string是什么,抱歉。
#2
0
You need to use a lot of pre compiler statements to exclude some parts of code and include others to make a code totally portable without modifications.
您需要使用许多预编译器语句来排除代码的某些部分,并包括其他部分,以使代码完全可移植,无需修改。
#1
3
There's no "magical wand" or "easy way" to do it.
没有什么“魔法棒”或“简单的方法”可以做到。
If your code is not 100% POSIX-compliant (and as far as I know Windows doesn't support that terribly well), your code is not going to run on Windows without emulation or rewriting it.
如果您的代码不是100%兼容posix(据我所知,Windows不太支持posix),那么您的代码在没有模拟或重写的情况下不会在Windows上运行。
You might try:
你可以试一试:
- http://www.cygwin.com/ - recompile your application with this
- http://www.cygwin.com/ -用这个重新编译你的应用程序
- A virtual machine on Windows
- Windows上的虚拟机
- See if a ported version of your sw exists
- 看看你的sw是否存在一个移植版本
- coLinux stuff (http://sourceforge.net/projects/portableubuntu/) - 32 bit only
- coLinux stuff (http://sourceforge.net/projects/portableubuntu/) - 32位
- Rewrite your app for Windows
- 为Windows重写应用程序
From the above, some headers might be replaced with equivalent ones (hopefully), e.g. try io.h
for some of the POSIX functionalities.. then you'll have to port linux sockets to Windows ones (and that's a relatively easy task). Openssl is multi-platform so no problem..
在上面,一些头可能被替换为等价的(希望),例如:try io。h表示一些POSIX函数。然后,您将不得不将linux套接字移植到Windows操作系统(这是一个相对简单的任务)。Openssl是多平台的,所以没有问题。
I don't know what my_global
and m_string
are, sorry.
我不知道my_global和m_string是什么,抱歉。
#2
0
You need to use a lot of pre compiler statements to exclude some parts of code and include others to make a code totally portable without modifications.
您需要使用许多预编译器语句来排除代码的某些部分,并包括其他部分,以使代码完全可移植,无需修改。