I have to build boost.python either using bjam or loading its .sln in VS
(I've used the second method).
Then I write some simple code like that in the tutorial exporting a
simple function and then what? I guess I have to build a .dll file for
python to link to. I'm building a dynamic link library project in VS8
write the appropriate code and that successfully creates a dll file.
However when importing my module python returns a runtime error:
ImportError: dynamic module does not define init function (inittest_boost)
What is the .pyd created in the tutorial? How is it created? I'm trying
to avoid bjam as and use just VS project files. Is that possible?
PS - I know I should send this message in c++-sig list but for three
days now it can not confirm my subscription for some reason.
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
> I'm trying to build a simple python extension similar to the one in
> boost.python tutorial. I really haven't yet understood the process of
> creating an extension for python using boost.
>
> I have to build boost.python either using bjam or loading its .sln in VS
> (I've used the second method).
>
> Then I write some simple code like that in the tutorial exporting a
> simple function and then what? I guess I have to build a .dll file for
> python to link to. I'm building a dynamic link library project in VS8
> write the appropriate code and that successfully creates a dll file.
> However when importing my module python returns a runtime error:
> ImportError: dynamic module does not define init function (inittest_boost)
You're missing a
BOOST_PYTHON_MODULE(test_boost)
in there.
> What is the .pyd created in the tutorial? How is it created? I'm trying
> to avoid bjam as and use just VS project files. Is that possible?
It's possible, but not supported. :)
> PS - I know I should send this message in c++-sig list but for three
> days now it can not confirm my subscription for some reason.
Ralf, any clues about that?
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
/*test_boost.h*/
#ifdef TEST_BOOST_EXPORTS
#define TEST_BOOST_API __declspec(dllexport)
#else
#define TEST_BOOST_API __declspec(dllimport)
#endif
TEST_BOOST_API const char* greet(void);
/*test_boost.cpp*/
// DllMain() and other dll stuff
....
#include <boost/python.hpp>
using namespace boost::python;
BOOST_PYTHON_MODULE(test_boost)
{
def("greet", greet);
}
const char* greet(void)
{
return "hello, world";
}
>> What is the .pyd created in the tutorial? How is it created? I'm trying
>> to avoid bjam as and use just VS project files. Is that possible?
>>
>
> It's possible, but not supported. :)
>
>
So what is actually that pyd and how is it created?
>> PS - I know I should send this message in c++-sig list but for three
>> days now it can not confirm my subscription for some reason.
>>
>
> Ralf, any clues about that?
>
>
I have just managed to subscribe to it.
Thanks
>>> ImportError: dynamic module does not define init function (inittest_boost)
>>>
>>
>> You're missing a
>>
>> BOOST_PYTHON_MODULE(test_boost)
>>
>> in there.
>>
>>
> Actually I don't. Here is my simple test:
>
> /*test_boost.h*/
> #ifdef TEST_BOOST_EXPORTS
> #define TEST_BOOST_API __declspec(dllexport)
> #else
> #define TEST_BOOST_API __declspec(dllimport)
> #endif
>
> TEST_BOOST_API const char* greet(void);
>
> /*test_boost.cpp*/
> // DllMain() and other dll stuff
> ....
> #include <boost/python.hpp>
> using namespace boost::python;
>
> BOOST_PYTHON_MODULE(test_boost)
> {
> def("greet", greet);
> }
>
> const char* greet(void)
> {
> return "hello, world";
> }
In that case, I don't know how to explain that problem. All I can
tell you is that you should use the supported build system, at least
once, to see how it's done.
>>> What is the .pyd created in the tutorial? How is it created? I'm trying
>>> to avoid bjam as and use just VS project files. Is that possible?
>>>
>>
>> It's possible, but not supported. :)
>>
>>
> So what is actually that pyd
It's a DLL.
> and how is it created?
Build it with bjam -d+2 and you'll see all the commands used.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
_______________________________________________