简体   繁体   English

enet_host_create在Windows上返回NULL

[英]enet_host_create returns NULL on Windows

I wrote a sample code using ENet, which was working fine under Linux but on Windows, enet_host_create returns NULL. 我使用ENet编写了一个示例代码,该代码在Linux下可以正常工作,但在Windows上,enet_host_create返回NULL。 This is a strange behavior since enet_host_create is one of the first function called while using ENet, previously any connection attempt. 这是一个奇怪的行为,因为enet_host_create是使用ENet时调用的第一个函数之一,以前是任何连接尝试。

enet_host_create returns NULL on Windows when you don't call enet_initialize() previously. 如果您先前未调用enet_initialize(),则enet_host_create在Windows上将返回NULL。 Don't forget to call enet_deinitialize() when you're done with the library, or at the exit of your program. 使用完库或在程序退出时,不要忘记调用enet_deinitialize()。

A program using ENET without calling the initialize function could work on linux since this function doesn't do much on this platform. 使用ENET而不调用initialize函数的程序可以在linux上工作,因为该函数在该平台上作用不大。 But on Windows, it will fail. 但是在Windows上,它将失败。

Thanks to the ENet community for their help resolving this issue. 感谢ENet社区为解决此问题所提供的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM