Pyrex problem - Py_NoneStruct

Gary Stephenson garys at ihug.com.au
Thu Dec 11 09:44:20 CET 2003


Hi John,

"John J. Lee" <jjl at pobox.com> wrote in message
news:878ylkydx9.fsf at pobox.com...
> "Gary Stephenson" <garys at ihug.com.au> writes:
>
> > I'm getting a clean generate, compile and link from my .pyx script, but
when
> > I attempt to run the resultant .exe, I get:
>
> Hmm, what resultant .exe?  Are you using py2exe or similar, or is
> there a feature of Pyrex I haven't noticed?  I've always ended up with
> a .so / .DLL.

Err, yes ...  I have used Pyrex before (successfully) using distutils to
produce a .DLL.  In this case, however, I am effectively attempting to embed
Python within another language (Xbase++), so I am compiling the pyrex
generated .c file using MSVC6 into an ..obj file and linking that into my
Xbase++ app.  It would appear that my problems arise from incorrect switches
to cl.exe.  fwiw, the switches I"m using are:  /c /Zl /Tc

I've searched high and low for some guidance on what the correct switches
might be, but alas to no avail thus far.  :-(

>
> >     "The procedure entry point Py_NoneStruct could not be located in the
> > dynamic link library python23.dll"
> [...]
>
> Had this before, but forget what the problem is.

Try, try .... please... <g>

> Try posting some Pyrex code (the pyrex list is probably a better place
> than here).

I have attempted to post this message along with the .pyx file to the pyrex
list, but  it would appear there is something wrong with my subscription as
I have received neither my own message not anybody else's since subscribing
:-(

cheers,

gary

The following is a somewhat cut down version of my .pyx file whichl produces
the error:

from scanners import xppScanner

ctypedef unsigned long ULONG
ctypedef void * XppParamList
ctypedef long BOOL
ctypedef void * ContainerHandle

cdef extern from "windows.h" :
    pass

cdef extern from "xppdef.h" :
    pass

cdef extern from "xppcon.h" :
    ULONG  _conGetNL( void * hNumeric, long *nlValue)
    void *  _conParam(void * pList, unsigned long paramIndex, long
*bReference)
    void *  _conPutC(    void * hDest, char *string)
    void *  _conPut(    void * hDest,     void * hSrc)
    BOOL _retnl(XppParamList pList, long numInt)
    BOOL _ret(XppParamList pList)
    unsigned long  _conRLockC(    void * hString, char **ppString, unsigned
long *ulSize)
    unsigned long  _conUnlockC(    void * hString)

cdef public BOOL C_OX_PYINITIALIZE( XppParamList pList ) :
    Py_Initialize()
    _ret( pList )

cdef public BOOL C_OX_PYFINALIZE( XppParamList pList ) :
    Py_Finalize()
    _ret( pList )

cdef public BOOL C_OX_XPPSCANNER( XppParamList pList ) :
    cdef ContainerHandle ch1
    cdef ULONG nRslt,nLen
    cdef BOOL pRef
    cdef object oScan,cStr

    ch1 = _conParam( pList, 1, &pRef )
    cStr = "test.prg"
    oScan = xppScanner( cStr ).gen()
    nRslt = <ULONG>oScan
    _retnl( pList, nRslt )

cdef public BOOL C_OX_XPPSCANNER_NEXTTOKEN( XppParamList pList ) :
    cdef ContainerHandle ch1,ch2,ch3
    cdef ULONG nLen
    cdef BOOL pRef

    ch1 = _conParam( pList, 1, &pRef )
    ch2 = _conParam( pList, 2, &pRef )
    ch3 = _conParam( pList, 3, &pRef )
    _conGetNL( ch1, <long*>&nLen )
    oScan = <object>nLen
    cTyp,cVal = oScan.next()
    _conPutC( ch2,cTyp )
    _conPutC( ch3,cVal )
    _ret( pList )






More information about the Python-list mailing list