[C++-sig] Exposing classes
Ira Holtzer
sheig222 at gmail.com
Wed Jul 27 09:59:22 CEST 2005
OK, I'm new at this so please bear with me.
First off, I'm using boost::python so what low level functions do you mean
(can you give me one name so I know where to start looking)?
Second, what I did is the following:
Created an exe file (SimplePython.exe ) what has a standard greet() function
and the boost::python declaration:
BOOST_PYTHON_MODULE(hello)
{
def("greet", greet);
}
I run the exe which feeds the interpreter with the script (via
PyRun_String):
import hello
print hello.greet()
To which the interpreter returns an exception saying "ImportError: No module
named hello.
Can this be a path problem, do I somehow need to specify a dll/exe that has
c++ exported symbols?
Thanks,
Ira
----- Original Message -----
From: "Pierre Barbier de Reuille" <pierre.barbier at cirad.fr>
Newsgroups: gmane.comp.python.c++
Sent: Wednesday, July 27, 2005 10:02 AM
Subject: Re: Exposing classes
Well, don't know for windows, but for Linux if your symbols are defined
inside your executable file, it works well ! Even your whole module can
be defined in your executable file. You just have to initialise it from
the C API with the low level functions (i.e. the ones who won't try to
look for a file named after your module name ...). Also, once your
module is loaded, every other "normal" import will just work !
Pierre
Ira a écrit :
> A question on basics...
>
> Do all my exposed C++ symbols need to be in .dll format (win32 of course)?
>
> What I mean is, can I have an exe running a python intrpreter where
exposed
> symbols are compiled *inside* the exe and somehow be able to access them
> from the python scripts?
>
> How would I import the modules in such a case?
>
> Thanks,
> Ira
>
>
>
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
>
--
Pierre Barbier de Reuille
INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP
Botanique et Bio-informatique de l'Architecture des Plantes
TA40/PSII, Boulevard de la Lironde
34398 MONTPELLIER CEDEX 5, France
tel : (33) 4 67 61 65 77 fax : (33) 4 67 61 56 68
More information about the Cplusplus-sig
mailing list