Address of an imported symbol is not always a constant

On Windows, the address of a symbol imported from a DLL is not
considered a constant.  Therefore, it can't be used to initialized
static data.
This commit is contained in:
Asanka Herath
2010-08-24 04:29:37 -04:00
committed by Asanka C. Herath
parent 6d4ac563d5
commit 4925fb863c

View File

@@ -52,7 +52,11 @@ struct testcase {
} tests[] = { } tests[] = {
/* 0 */ /* 0 */
{ {
&asn1_oid_id_pkinit_kdf_ah_sha1, /* AlgorithmIdentifier */ NULL, /* AlgorithmIdentifier */
/* == &asn1_oid_id_pkinit_kdf_ah_sha1. Addresses of exported
* symbols are not considered constant on all platforms
* (Windows). So we set it in main() below. */
{ /* Z */ { /* Z */
256, 256,
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -260,6 +264,8 @@ main(int argc, char **argv)
if (ret) if (ret)
errx (1, "krb5_init_context failed: %d", ret); errx (1, "krb5_init_context failed: %d", ret);
tests[0].oid = &asn1_oid_id_pkinit_kdf_ah_sha1;
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
test_dh2key(context, i, &tests[i]); test_dh2key(context, i, &tests[i]);