dpull / skynet-mingw

对skynet无任何改动的windows版
http://blog.dpull.com/post/2015-11-08-skynet_mingw
MIT License
307 stars 126 forks source link

关于代码的一些问题 #12

Closed yuangu closed 6 years ago

yuangu commented 6 years ago

我是使用xubuntu16.04交叉编译的这份代码。 其中有这么几个问题: 1、是不是只能编译32位的代码?我编译64位的后,执行会报: Expression: sizeof(struct epoll_fd*) <= sizeof(int)

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

2、windows.h和ws2tcpip.h建议使用小写。因为linux下的mingw32这二个文件是小写的。win下对大小写不敏感。所以应当没有什么问题。

3、socket下的.h文件中的 EWOULDBLOCK和 EINPROGRESS定义用#ifndef #define #endif

ifndef EWOULDBLOCK

define EWOULDBLOCK WSAEWOULDBLOCK

endif

ifndef EINPROGRESS

define EINPROGRESS WSAEINPROGRESS

endif

4、关于dlfcn.h缺失问题,我不知道win上的mingw32存不存在这个问题。但是ubuntu上是存在的。我是使用 https://github.com/dlfcn-win32/dlfcn-win32 来替代的。

5、platform.h中的 enum { CLOCK_THREAD_CPUTIME_ID, CLOCK_REALTIME, CLOCK_MONOTONIC }; 和 enum { LOCK_EX, LOCK_NB };莫名冲突。后面我发现与pthread_time.h里的定义冲突了,你看一下,要不要使用pthread_time.h来替代一下。

最后,为你这个项目点个赞,让我们能够在win上学习skynet

dpull commented 6 years ago
  1. 是的。 目前只是支持mingw32,有个支持mingw64的pr,但因为没有作者没有后续,而我暂时没时间维护,所以搁置了
  2. 在windows下Windows.h WS2tcpip.h 是如此大小写拼写的
  3. 可以改一下 但我建议是 #undef EWOULDBLOCK 因为担心winsocket返回的错误码不一致,这个你看如何?
  4. 我周末研究下

================================== 另外,为何你要在ubuntu下使用这个版本呢?

yuangu commented 6 years ago

mingw32下载真的很慢,但是在ubuntu上只要一个命令就能装上。所以就用,哈哈!!!!!我已经编译好了,现在在用着,挺不错的。

dpull commented 6 years ago
  1. 现在的epool已经支持64位
  2. 已经整理为 Windows.h WS2tcpip.h
  3. 增加了 #ifndef #define #endif
  4. mingw32下没有pthread_time.h