Skip to main content
GameDev.net gamedev.net
🔒 Locked

how to expose static member variable in boost python?

Started by aayudh Mar 25, 2009 at 11:28 PM 0 replies 4k views
Original Post
aayudh
aayudh
Hi, I have a static variable in my struct which I am trying to expose to python using boost.python

class y {
...
};

struct x {
int a;
static y b;
};

...
class_<x>("x")
.def_readonly("b", make_getter(&x::b, return_value_policy<reference_existing_object>() ))

class_<y>("y")
...
this code compiles in gcc. But when the dynamic lib is imported in python, it reports an import error related to this static variable as "undefined symbol " with crazy syntaxed x.b (_ZN6x2bE ) Can anyone tell me how I can expose a static class member without any problem !!
Oxyd
Oxyd
Blind guess: did you define your x::b? I mean, do you have y x::b; somewhere in one of your .cpp files?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.