rand_s 代表 MinGW
我发现 rand_s
函数(CRT 的一部分)在开发应用程序时非常有用。然而,据我了解,它在最近的 MinGW 头文件中并未原型化。
因此,我要求提供一种全面的方法来提供此类功能或对其进行原型设计。我考虑过使用 #ifdef MINGW
样式挂钩,但是,如果未来的修订开始对函数进行原型设计,这可能会失败。
因此,使该函数可供我的程序使用以便可以使用 MinGW 进行编译的最佳方法是什么?
I have found the rand_s
function, part of the CRT, to be extremely useful while developing my application. However, it is my understanding that it is not prototyped in recent MinGW header files.
Therefore I am asking for a comprehensive means of either providing or prototyping such a function. I have considered using an #ifdef MINGW
style hook, however, this may fail should future revisions start prototyping the function.
Therefore, what is the best way of making the function available to my program such that it can be compiled with MinGW?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决这个问题的一种黑客方法是:
这样,如果 mingw 开始为其提供原型,它就不会干扰(除非他们将其作为宏提供,这是不可能的)。
One hackish way to work around this is:
That way, if mingw starts providing a prototype for it, it will not interfere (unless they provide it as a macro, which is unlikely).