Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63064774
external_module.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, May 17, 13:24
Size
554 B
Mime Type
text/x-c
Expires
Sun, May 19, 13:24 (2 d)
Engine
blob
Format
Raw Data
Handle
17727635
Attached To
R9490 Homework_sp4e_Peruzzo_SáezUribe
external_module.cpp
View Options
#include <pybind11/pybind11.h>
namespace
py
=
pybind11
;
/* Simple test module/test class to check that the referenced internals data of external pybind11
* modules aren't preserved over a finalize/initialize.
*/
PYBIND11_MODULE
(
external_module
,
m
)
{
class
A
{
public
:
A
(
int
value
)
:
v
{
value
}
{};
int
v
;
};
py
::
class_
<
A
>
(
m
,
"A"
)
.
def
(
py
::
init
<
int
>
())
.
def_readwrite
(
"value"
,
&
A
::
v
);
m
.
def
(
"internals_at"
,
[]()
{
return
reinterpret_cast
<
uintptr_t
>
(
&
py
::
detail
::
get_internals
());
});
}
Event Timeline
Log In to Comment