Running PythonNN.DLL as debug or release?

S

Stephen Kellett

Hi Folks,

We've been using Python embedded in an application for a while now,
where the Python dll is PythonNN.dll, NN being the version number, such
as Python24.dll.

Recently it was pointed out to me that Python can run in a debug or
release configuration and that you can specify this on the command line
using -O and -OO.

My question is how do I specify this to the Python DLL I have embedded
in my application? Is it as straightforward as:
o Use PythonNN.dll for release mode Python
o Use PythonNN_d.dll for debug mode Python

and if so, how do I specify I want -O or -OO with release mode?

I've tried looking at the C API documentation but couldn't find anything
useful there.

We are using versions of Python from 2.2 upwards.

Cheers

Stephen
 
F

Fredrik Lundh

Stephen said:
We've been using Python embedded in an application for a while now,
where the Python dll is PythonNN.dll, NN being the version number, such
as Python24.dll.

Recently it was pointed out to me that Python can run in a debug or
release configuration and that you can specify this on the command line
using -O and -OO.

whoever pointed that out to you was confused: -O and -OO are optimization
flags used by the Python interpreter, and has nothing to do with what Python
runtime you're using.

$ python -h
usage: python [option] ... [-c cmd | file | -] [arg] ...
Options and arguments (and corresponding environment variables):
....
-O : optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x)
-OO : remove doc-strings in addition to the -O optimizations
....

if you want to use these from your C code, setting the global Py_OptimizeFlag
to 1 (-O) or 2 (-OO) should work.

</F>
 
S

Stephen Kellett

-O : optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x)
-OO : remove doc-strings in addition to the -O optimizations
...

if you want to use these from your C code, setting the global Py_OptimizeFlag
to 1 (-O) or 2 (-OO) should work.

Yes that is what I wanted to do. Thank you very much.

Stephen
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top