BOOST again: how to proceed from here....

Discussion in 'Python' started by Osiris, Jan 1, 2007.

  1. Osiris

    Osiris Guest

    I'm trying to work with Boost, trying to use my C-code from Python..
    So now I have generated a C_test2.dll and a C_test2.lib with Visual
    C++ 2005, from code like this:
    ===============
    #include <stdlib.h>
    #include <stdafx.h>

    namespace { // Avoid cluttering the global namespace.

    int my_int; /* a global integer: or outside namespace ? */
    double calc ( double f)
    {
    my_int = (int) (f/2);
    // printf( "Half of %f is %d\n", f, my_int );
    return f/2;
    }

    }

    #include <boost/python.hpp>

    using namespace boost::python;

    BOOST_PYTHON_MODULE( half )
    {
    def("calc", calc );
    }
    =====================

    Now I want to use calc from Python.
    I have my Python in c:\python24\ (IDLE system, version 2.4.4)
    Where do I put the dll and lib ?

    in c:\python24\libs and c:\python24\DLLs ?

    and do I import like:
    import C_test2.dll
    ?
    because now I get this:

    Traceback (most recent call last):
    File "<pyshell#1>", line 1, in -toplevel-
    import C_test2.dll
    ImportError: DLL load failed: The specified module could not be found.
     
    Osiris, Jan 1, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff User

    Best way to proceed

    Jeff User, Dec 7, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    416
    Robbe Morris [C# MVP]
    Dec 7, 2005
  2. Replies:
    0
    Views:
    551
  3. Daniel Mark
    Replies:
    9
    Views:
    12,618
    Simon Brunning
    Sep 19, 2006
  4. sanjay
    Replies:
    1
    Views:
    242
    Bob Barrows [MVP]
    Feb 22, 2005
  5. aa
    Replies:
    6
    Views:
    172
Loading...

Share This Page