2 * perl_math_int64.c - This file is in the public domain
3 * Author: "Salvador Fandino <sfandino@yahoo.com>, Dave Rolsky <autarch@urth.org>"
5 * Generated on: 2016-01-04 10:07:18
6 * Math::Int64 version: 0.54
7 * Module::CAPIMaker version:
20 typedef __int64
int64_t;
21 typedef unsigned __int64
uint64_t;
24 /* you may need to add a typemap for int64_t here if it is not defined
25 by default in your C header files */
27 HV
*math_int64_c_api_hash
;
28 int math_int64_c_api_min_version
;
29 int math_int64_c_api_max_version
;
31 int64_t (*math_int64_c_api_SvI64
)(pTHX_ SV
*);
32 int (*math_int64_c_api_SvI64OK
)(pTHX_ SV
*);
33 uint64_t (*math_int64_c_api_SvU64
)(pTHX_ SV
*);
34 int (*math_int64_c_api_SvU64OK
)(pTHX_ SV
*);
35 SV
* (*math_int64_c_api_newSVi64
)(pTHX_
int64_t);
36 SV
* (*math_int64_c_api_newSVu64
)(pTHX_
uint64_t);
37 uint64_t (*math_int64_c_api_randU64
)(pTHX
);
40 perl_math_int64_load(int required_version
) {
43 eval_pv("require Math::Int64", TRUE
);
44 if (SvTRUE(ERRSV
)) return 0;
46 math_int64_c_api_hash
= get_hv("Math::Int64::C_API", 0);
47 if (!math_int64_c_api_hash
) {
48 sv_setpv(ERRSV
, "Unable to load Math::Int64 C API");
53 svp
= hv_fetch(math_int64_c_api_hash
, "min_version", 11, 0);
54 if (!svp
) svp
= hv_fetch(math_int64_c_api_hash
, "version", 7, 1);
56 sv_setpv(ERRSV
, "Unable to retrieve C API version for Math::Int64");
60 math_int64_c_api_min_version
= SvIV(*svp
);
62 svp
= hv_fetch(math_int64_c_api_hash
, "max_version", 11, 0);
63 if (!svp
) svp
= hv_fetch(math_int64_c_api_hash
, "version", 7, 1);
65 sv_setpv(ERRSV
, "Unable to retrieve C API version for Math::Int64");
69 math_int64_c_api_max_version
= SvIV(*svp
);
71 if ((required_version
< math_int64_c_api_min_version
) ||
72 (required_version
> math_int64_c_api_max_version
)) {
74 "Math::Int64 C API version mismatch. "
75 "The installed module supports versions %d to %d but %d is required",
76 math_int64_c_api_min_version
,
77 math_int64_c_api_max_version
,
83 svp
= hv_fetch(math_int64_c_api_hash
, "SvI64", 5, 0);
85 sv_setpv(ERRSV
, "Unable to fetch pointer 'SvI64' C function from Math::Int64");
89 math_int64_c_api_SvI64
= INT2PTR(void *, SvIV(*svp
));
90 svp
= hv_fetch(math_int64_c_api_hash
, "SvI64OK", 7, 0);
92 sv_setpv(ERRSV
, "Unable to fetch pointer 'SvI64OK' C function from Math::Int64");
96 math_int64_c_api_SvI64OK
= INT2PTR(void *, SvIV(*svp
));
97 svp
= hv_fetch(math_int64_c_api_hash
, "SvU64", 5, 0);
99 sv_setpv(ERRSV
, "Unable to fetch pointer 'SvU64' C function from Math::Int64");
103 math_int64_c_api_SvU64
= INT2PTR(void *, SvIV(*svp
));
104 svp
= hv_fetch(math_int64_c_api_hash
, "SvU64OK", 7, 0);
106 sv_setpv(ERRSV
, "Unable to fetch pointer 'SvU64OK' C function from Math::Int64");
110 math_int64_c_api_SvU64OK
= INT2PTR(void *, SvIV(*svp
));
111 svp
= hv_fetch(math_int64_c_api_hash
, "newSVi64", 8, 0);
113 sv_setpv(ERRSV
, "Unable to fetch pointer 'newSVi64' C function from Math::Int64");
117 math_int64_c_api_newSVi64
= INT2PTR(void *, SvIV(*svp
));
118 svp
= hv_fetch(math_int64_c_api_hash
, "newSVu64", 8, 0);
120 sv_setpv(ERRSV
, "Unable to fetch pointer 'newSVu64' C function from Math::Int64");
124 math_int64_c_api_newSVu64
= INT2PTR(void *, SvIV(*svp
));
125 svp
= hv_fetch(math_int64_c_api_hash
, "randU64", 7, 0);
127 sv_setpv(ERRSV
, "Unable to fetch pointer 'randU64' C function from Math::Int64");
131 math_int64_c_api_randU64
= INT2PTR(void *, SvIV(*svp
));