windll question

Michel Orengo michelorengo at netscape.com
Thu Dec 2 17:54:55 EST 1999


I had the same bug with the attribute exception. I did something (stupid?)
to correct the script windll.py
In the class module change the unload function to:

 def unload (self):
  if self.loaded and self.handle:
   self.funs = {}
   if calldll:
    calldll.free_library (self.handle)

It works so far with all my scripts, but I do not assume any
responsibility.

As far as the structure and c word, I have some example I can share with
you if you want. I do not attached the files so the sake of this newsgroup
but you can write to me directly.
Basically, the simple way do to it is to use strucob.Oracle such as:

# Definition of the structures
# ----------------------------
ctlHdr = structob.Oracle ('Control Header Record',
     'N6c6c55c2c',
     ('Count', 'Processed', 'Pad', 'CrlL')
    )
ctlRec = structob.Oracle ('Control Record',
     'N32c9c9cc10c6c6c2c',
     ('FileName', 'Start', 'Length', 'Status', 'Comments', 'InSeqNum',
'OutSeqNum', 'CrlL')
    )

For:
typedef struct
{
 char szCount[6];  // total number of records in the file
 char szProcessed[6];  // number records processed
 char szPad[55];        // pad
 char szCrlL[2];        // end of record
} CTLHDR;

typedef struct
{
 char szFileName[32]; // filename
 char szStart[9];        // offset of message in file
 char szLength[9];     // length of message
 char szStatus[l];       // status
 char szComment[10];  // comments
 char szIseq[6];       // input sequence number
 char szOseq[6];       // output sequence number
 char szCrLf[2];     // end of record
} CTLREC;


calishar at my-deja.com wrote:

> Hi Folks,
>
>   Thanks to some good advice earlier this week, I am now playing around
> with calldll and windll, and thanks to a post from Eric Jacobs (the
> Prototype lambda function) it is a lot easier now.
>
>   Unfortunately (you knew there had to be a but right?) there are two
> things I can not figure out how to pass. One is a struct, and the other
> is a word (c word, not english word).
>
>   I'm not sure what a word is (I know it is a variation of integer,
> does that mean I can just use i in the format string?) but I have no
> clue what format string to use for a struct, or how to construct it in
> Python.
>
>   If one of the Pythonistas could spare some time to help me out with
> this, it would be greatly appreciated. Bascially I think what I need is
> a step by step guide interfacing with external dll's.
>
>   Also, I followed some of the advice passed on in here earlier on, on
> setting up my calldll and dynwin distributions. Well, I can run the
> dlldemo script, and get the message box saying my double-click speed
> is.... but when I click OK I get an error in the command line window.
>   'npstruct module error: unsupported byte order code'
> followed by three errors about 'None' objects not having
> a 'free_library' attribute. Is this normal for the package at the
> moment?
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.





More information about the Python-list mailing list