[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Embedding Python - Freeing Python Objects Not Using Py_DECREF

Yuri Feldman

1/17/2008 12:15:00 PM

Hello,

I'm embedding Python interpreter in a Win32 console application. I use
C++.

I would like to use the WinAPI LoadLibrary function to load the python
dll at runtime (followed by GetProcAddress calls), so that I have to
make no assumptions about the location of the dll.

However I can't use the macro Py_DECREF if I load the dll this way.

Is there a way to properly free python objects (specifically -
dictionaries created by PyDict_New() and the object returned by
PyRun_String()) not using Py_DECREF?

Alternatively, is there a way to include the python header - to make
the macro Py_DECREF available, but to be able to locate the python dll
whenever python is installed?

(The problem is that python may be installed anywhere, and the python
dll does not always appear in system folders - sometimes it is in the
python installation directory, thus it is unclear which targets to
specify to the linker to search for the dll).

I'd appreciate any help.
Thanks in advance,
94 Answers

Thomas Heller

1/17/2008 2:17:00 PM

0

yuri.feldman@gmail.com schrieb:
> Hello,
>
> I'm embedding Python interpreter in a Win32 console application. I use
> C++.
>
> I would like to use the WinAPI LoadLibrary function to load the python
> dll at runtime (followed by GetProcAddress calls), so that I have to
> make no assumptions about the location of the dll.
>
> However I can't use the macro Py_DECREF if I load the dll this way.
>
> Is there a way to properly free python objects (specifically -
> dictionaries created by PyDict_New() and the object returned by
> PyRun_String()) not using Py_DECREF?
>
> Alternatively, is there a way to include the python header - to make
> the macro Py_DECREF available, but to be able to locate the python dll
> whenever python is installed?
>
> (The problem is that python may be installed anywhere, and the python
> dll does not always appear in system folders - sometimes it is in the
> python installation directory, thus it is unclear which targets to
> specify to the linker to search for the dll).

Use the Py_DecRef function, which was added for exactly this purpose.

Thomas

Tashi

5/30/2014 2:51:00 AM

0

On Sunday, May 25, 2014 5:55:34 AM UTC-6, addy744 wrote:
> On 5/22/2014 6:18 PM, Andrew Schulman wrote:
>
> > http://www.huffingtonpost.com/2014/05/22/aliens-congress-seti-astronomers_n_53...
>
> >
>
> > Andrew
>
> >
>
>
>
> Does anybody reading this, run SETI@home?
>
> It stands for 'Search for Extraterrestrial Intelligence'. UC Berkley
>
> runs this research project where we can have our home computer
>
> help search for signals from Extraterrestrial Intelligences on our
>
> computer's downtime, or even continually. You have to download
>
> a program that sends your computer blocks of data from their radio
>
> telescopes for your computer to analyze. I'm hoping my humble
>
> desktop pc finds the first confirmed alien signal. I surf with my
>
> laptop pc and let the desktop pc run SETI pretty much 24/7.
>
> Addy

They are already here SETI is just a diversion, NASA has them on film. Edgar Mitch, Gordon Cooper, Buzz Aldrin just to name a few have seen UFO's.
https://www.youtube.com/watch?v=X...

Then of course there is the case of Bentwaters Rendelsham Forrest England where 80 military security personal and officers had seen and even touch the craft.
https://www.youtube.com/watch?v=x...

Yes, every Tom, Dick, and Larry, will tell you all of the credible witness were simply hallucinating on a nuclear armed air force base and if that was the case it seems in the interest of national security they all should have been released from duty....... but no one was.

Andrew Robinson

5/30/2014 3:34:00 AM

0

On Thursday, May 29, 2014 9:51:06 PM UTC-5, dewach...@gmail.com wrote:
> On Sunday, May 25, 2014 5:55:34 AM UTC-6, addy744 wrote:
>
> > On 5/22/2014 6:18 PM, Andrew Schulman wrote:
>
> >
>
> > > http://www.huffingtonpost.com/2014/05/22/aliens-congress-seti-astronomers_n_53...
>
> >
>
> > >
>
> >
>
> > > Andrew
>
> >
>
> > >
>
> >
>
> >
>
> >
>
> > Does anybody reading this, run SETI@home?
>
> >
>
> > It stands for 'Search for Extraterrestrial Intelligence'. UC Berkley
>
> >
>
> > runs this research project where we can have our home computer
>
> >
>
> > help search for signals from Extraterrestrial Intelligences on our
>
> >
>
> > computer's downtime, or even continually. You have to download
>
> >
>
> > a program that sends your computer blocks of data from their radio
>
> >
>
> > telescopes for your computer to analyze. I'm hoping my humble
>
> >
>
> > desktop pc finds the first confirmed alien signal. I surf with my
>
> >
>
> > laptop pc and let the desktop pc run SETI pretty much 24/7.
>
> >
>
> > Addy
>
>
>
> They are already here SETI is just a diversion, NASA has them on film. Edgar Mitch, Gordon Cooper, Buzz Aldrin just to name a few have seen UFO's.
>
> https://www.youtube.com/watch?v=X...
>
>
>
> Then of course there is the case of Bentwaters Rendelsham Forrest England where 80 military security personal and officers had seen and even touch the craft.
>
> https://www.youtube.com/watch?v=x...
>
>
>
> Yes, every Tom, Dick, and Larry, will tell you all of the credible witness were simply hallucinating on a nuclear armed air force base and if that was the case it seems in the interest of national security they all should have been released from duty....... but no one was.

http://www.youtube.com/watch?v=NSJElZwEI8o&...

Tashi

5/31/2014 5:34:00 AM

0

On Thursday, May 29, 2014 9:33:59 PM UTC-6, wollybyrde wrote:
> On Thursday, May 29, 2014 9:51:06 PM UTC-5, dewach...@gmail.com wrote:
>
> > On Sunday, May 25, 2014 5:55:34 AM UTC-6, addy744 wrote:
>
> >
>
> > > On 5/22/2014 6:18 PM, Andrew Schulman wrote:
>
> >
>
> > >
>
> >
>
> > > > http://www.huffingtonpost.com/2014/05/22/aliens-congress-seti-astronomers_n_53...
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Andrew
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Does anybody reading this, run SETI@home?
>
> >
>
> > >
>
> >
>
> > > It stands for 'Search for Extraterrestrial Intelligence'. UC Berkley
>
> >
>
> > >
>
> >
>
> > > runs this research project where we can have our home computer
>
> >
>
> > >
>
> >
>
> > > help search for signals from Extraterrestrial Intelligences on our
>
> >
>
> > >
>
> >
>
> > > computer's downtime, or even continually. You have to download
>
> >
>
> > >
>
> >
>
> > > a program that sends your computer blocks of data from their radio
>
> >
>
> > >
>
> >
>
> > > telescopes for your computer to analyze. I'm hoping my humble
>
> >
>
> > >
>
> >
>
> > > desktop pc finds the first confirmed alien signal. I surf with my
>
> >
>
> > >
>
> >
>
> > > laptop pc and let the desktop pc run SETI pretty much 24/7.
>
> >
>
> > >
>
> >
>
> > > Addy
>
> >
>
> >
>
> >
>
> > They are already here SETI is just a diversion, NASA has them on film. Edgar Mitch, Gordon Cooper, Buzz Aldrin just to name a few have seen UFO's..
>
> >
>
> > https://www.youtube.com/watch?v=X...
>
> >
>
> >
>
> >
>
> > Then of course there is the case of Bentwaters Rendelsham Forrest England where 80 military security personal and officers had seen and even touch the craft.
>
> >
>
> > https://www.youtube.com/watch?v=x...
>
> >
>
> >
>
> >
>
> > Yes, every Tom, Dick, and Larry, will tell you all of the credible witness were simply hallucinating on a nuclear armed air force base and if that was the case it seems in the interest of national security they all should have been released from duty....... but no one was.
>
>
>
> http://www.youtube.com/watch?v=NSJElZwEI8o&...

I can't stand that guy! Lets see..... Neil verse...... Edger Mitchell, Gordon Cooper, Buzz Aldrin, I'll these guys anyway over Neil the 5th grade science teacher.

Slogoin

5/31/2014 5:45:00 AM

0

On Friday, May 30, 2014 10:34:22 PM UTC-7, dewach...@gmail.com wrote:
> On Thursday, May 29, 2014 9:33:59 PM UTC-6, wollybyrde wrote:
>
> Neil the 5th grade science teacher.

LOL!!!!!!

Andrew Robinson

5/31/2014 11:44:00 AM

0

On Saturday, May 31, 2014 12:34:22 AM UTC-5, dewach...@gmail.com wrote:
> On Thursday, May 29, 2014 9:33:59 PM UTC-6, wollybyrde wrote:
>
> > On Thursday, May 29, 2014 9:51:06 PM UTC-5, dewach...@gmail.com wrote:
>
> >
>
> > > On Sunday, May 25, 2014 5:55:34 AM UTC-6, addy744 wrote:
>
> >
>
> > >
>
> >
>
> > > > On 5/22/2014 6:18 PM, Andrew Schulman wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > http://www.huffingtonpost.com/2014/05/22/aliens-congress-seti-astronomers_n_53...
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Andrew
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Does anybody reading this, run SETI@home?
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > It stands for 'Search for Extraterrestrial Intelligence'. UC Berkley
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > runs this research project where we can have our home computer
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > help search for signals from Extraterrestrial Intelligences on our
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > computer's downtime, or even continually. You have to download
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > a program that sends your computer blocks of data from their radio
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > telescopes for your computer to analyze. I'm hoping my humble
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > desktop pc finds the first confirmed alien signal. I surf with my
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > laptop pc and let the desktop pc run SETI pretty much 24/7.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Addy
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > They are already here SETI is just a diversion, NASA has them on film.. Edgar Mitch, Gordon Cooper, Buzz Aldrin just to name a few have seen UFO's.
>
> >
>
> > >
>
> >
>
> > > https://www.youtube.com/watch?v=X...
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Then of course there is the case of Bentwaters Rendelsham Forrest England where 80 military security personal and officers had seen and even touch the craft.
>
> >
>
> > >
>
> >
>
> > > https://www.youtube.com/watch?v=x...
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Yes, every Tom, Dick, and Larry, will tell you all of the credible witness were simply hallucinating on a nuclear armed air force base and if that was the case it seems in the interest of national security they all should have been released from duty....... but no one was.
>
> >
>
> >
>
> >
>
> > http://www.youtube.com/watch?v=NSJElZwEI8o&...
>
>
>
> I can't stand that guy! Lets see..... Neil verse...... Edger Mitchell, Gordon Cooper, Buzz Aldrin, I'll these guys anyway over Neil the 5th grade science teacher.

.....which is what you said about Michio Kaku, too

Tashi

5/31/2014 3:39:00 PM

0

I've come to not like any of these bozos who are featured on the nightly news.

Andrew Robinson

5/31/2014 3:47:00 PM

0

On Saturday, May 31, 2014 10:39:20 AM UTC-5, dewach...@gmail.com wrote:
> I've come to not like any of these bozos who are featured on the nightly news.

no kidding. It's called confirmation bias.
People like them because they speak English, as well as being very accomplished...I know people see things or think they see things. It doesn't mean there are ETs in them.

Slogoin

5/31/2014 3:53:00 PM

0

On Saturday, May 31, 2014 8:39:20 AM UTC-7, dewach...@gmail.com wrote:
> I've come to not like any of these bozos who are featured on the nightly news.

LOL! I'm sure Neil would be so hurt to hear that you don't like him.

Slogoin

5/31/2014 3:56:00 PM

0

On Saturday, May 31, 2014 8:46:34 AM UTC-7, wollybyrde wrote:
>
> no kidding. It's called confirmation bias.
>

And you know it well.