Repository navigation
gh-141004: Document symbol visibility macros (PyAPI_DATA, Py_EXPORTED_SYMBOL, Py_LOCAL_SYMBOL,Py_IMPORTED_SYMBOL) #143508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1cfd683
0164c79
d0c5c25
d3e69b6
68269d3
113ff5e
9eb597b
6b9df7f
26cffa2
6c59e9b
2f24241
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -376,6 +376,39 @@ complete listing. | |
| sizeof(array) / sizeof((array)[0]) | ||
|
|
||
|
|
||
| .. c:macro:: Py_EXPORTED_SYMBOL | ||
|
|
||
| Macro used to declare a symbol (function or data) as exported from a shared library. | ||
| On Windows, this expands to ``__declspec(dllexport)``. | ||
| On other platforms with visibility support, it | ||
| expands to ``__attribute__((visibility("default")))``. | ||
|
|
||
|
|
||
| .. c:macro:: Py_IMPORTED_SYMBOL | ||
|
|
||
| Macro used to declare a symbol as imported from a shared library. | ||
| On Windows, this expands to ``__declspec(dllimport)``. | ||
| On other platforms, it is usually empty or standard visibility. | ||
|
Yashp002 marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
| .. c:macro:: PyAPI_DATA(type) | ||
|
encukou marked this conversation as resolved.
|
||
|
|
||
| Macro used to declare a public global variable. | ||
| It expands to ``extern Py_EXPORTED_SYMBOL type`` or ``extern Py_IMPORTED_SYMBOL type`` | ||
| depending on whether the core is being built or used. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would also add: "This macro is intended for defining CPython's C API itself; extension modules should not use it for their own symbols."
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gonna push a PR for the manual changes in a bit yes, thank you for the corrections
Yashp002 marked this conversation as resolved.
Outdated
|
||
|
|
||
| Example usage:: | ||
|
|
||
| PyAPI_DATA(PyObject *) _Py_NoneStruct; | ||
|
|
||
|
|
||
| .. c:macro:: Py_LOCAL_SYMBOL | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you move this next to the other
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess |
||
|
|
||
| Macro used to declare a symbol as local to the shared library (hidden). | ||
| It ensures the symbol is not exported. | ||
| On platforms with visibility support, it | ||
| expands to ``__attribute__((visibility("hidden")))``. | ||
|
|
||
| .. _api-objects: | ||
|
|
||
| Objects, Types and Reference Counts | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.