在 OpenSolaris($^O eq 'solaris',版本 2.11)上,我正在尝试构建一个使用 XPGv4v2/Single Unix Spec 的 XS 模块。了解struct msghdr
,专门针对“辅助资料”的审讯。
然而,原生 perl (v5.8.4) 是在没有必要定义的情况下构建的,因此struct msghdr
在我的 XS 文件中可见的是较旧的 BSD 类型::
#include "EXTERN.h"
#include "perl.h" /* older, "msg_accrights"-style msghdr now visible */
#include "XSUB.h"
....
struct msghdr m;
m.msg_control = buf; /* ERROR, structure has no member named "msg_control" */
....
提供“正确的” #define
s (_XOPEN_SOURCE
和_XOPEN_SOURCE_EXTENDED
) 会破坏构建,因为它改变了 perl 所期望的许多事情。
有没有一种优雅的方式可以让 XS 模块使用我想要的结构定义?