* Module initialize function: fetch function pointers for cross-module calls. */
| 34 | * Module initialize function: fetch function pointers for cross-module calls. |
| 35 | */ |
| 36 | void |
| 37 | _PG_init(void) |
| 38 | { |
| 39 | /* Asserts verify that typedefs above match original declarations */ |
| 40 | AssertVariableIsOfType(&PLyObject_AsString, PLyObject_AsString_t); |
| 41 | PLyObject_AsString_p = (PLyObject_AsString_t) |
| 42 | load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLyObject_AsString", |
| 43 | true, NULL); |
| 44 | #if PY_MAJOR_VERSION >= 3 |
| 45 | AssertVariableIsOfType(&PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_t); |
| 46 | PLyUnicode_FromStringAndSize_p = (PLyUnicode_FromStringAndSize_t) |
| 47 | load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLyUnicode_FromStringAndSize", |
| 48 | true, NULL); |
| 49 | #endif |
| 50 | AssertVariableIsOfType(&hstoreUpgrade, hstoreUpgrade_t); |
| 51 | hstoreUpgrade_p = (hstoreUpgrade_t) |
| 52 | load_external_function("$libdir/hstore", "hstoreUpgrade", |
| 53 | true, NULL); |
| 54 | AssertVariableIsOfType(&hstoreUniquePairs, hstoreUniquePairs_t); |
| 55 | hstoreUniquePairs_p = (hstoreUniquePairs_t) |
| 56 | load_external_function("$libdir/hstore", "hstoreUniquePairs", |
| 57 | true, NULL); |
| 58 | AssertVariableIsOfType(&hstorePairs, hstorePairs_t); |
| 59 | hstorePairs_p = (hstorePairs_t) |
| 60 | load_external_function("$libdir/hstore", "hstorePairs", |
| 61 | true, NULL); |
| 62 | AssertVariableIsOfType(&hstoreCheckKeyLen, hstoreCheckKeyLen_t); |
| 63 | hstoreCheckKeyLen_p = (hstoreCheckKeyLen_t) |
| 64 | load_external_function("$libdir/hstore", "hstoreCheckKeyLen", |
| 65 | true, NULL); |
| 66 | AssertVariableIsOfType(&hstoreCheckValLen, hstoreCheckValLen_t); |
| 67 | hstoreCheckValLen_p = (hstoreCheckValLen_t) |
| 68 | load_external_function("$libdir/hstore", "hstoreCheckValLen", |
| 69 | true, NULL); |
| 70 | } |
| 71 | |
| 72 | |
| 73 | /* These defines must be after the module init function */ |
nothing calls this directly
no test coverage detected