Is it possible to know how to use an undocumented .pyd file?

Alex Martelli alex at magenta.com
Sat Aug 19 03:47:49 EDT 2000


"Courageous" <jkraska1 at san.rr.com> wrote in message
news:399DFA4D.1F7BFB3C at san.rr.com...
> Luke Chen wrote:
> >
> > Hi.
> >
> > Is it possible to know how to use an undocumented .pyd file?
>
> I'm going out on a limb here, but aren't .pdy files just .dlls in
> disguise?

Yes, AFAIK.


> If so, there is probably a way to scan the .dll for likely
> functions (dlsym or some such).

No, I think; the only function a module foo.pyd needs to
expose is initfoo (I guess it may expose others, but it
does not have to; they will be obtained by address via
initfoo).  You might try calling initfoo and see what that
one tells Python, I guess, but I think you'd need some
non-portable Python or C, depending on the platform.


> You might also see what shows up in
> <module>.__dict__. Ala:
>
> >>>> import string
> >>>> string.__dict__

This might be a better bet, I guess.  But once you do
know the exposed names, there's still a long way to
go, to understand what arguments are desired and what
is their significance.


Alex






More information about the Python-list mailing list