Writing an Extension: 2 questions (so far)

Steve Holden sholden at holdenweb.com
Thu Jan 3 10:52:48 EST 2002


"Tyler W. Wilson" <tyler.w.wilson at gte.net> wrote in message
news:WW_Y7.101$nu1.55992 at dfiatx1-snr1.gtei.net...
> 1) I have the basic skeleton working for an extension. Now I want to know
on
> the C side when the user does a del <module>. What entry in the
PhMethodDef
> structure should I add, or is there a global function that is called?
>
> I noticed that after I do import <module> then a del <module>, my DLL is
> still in memory. Is this expected. I would have expected it to
> reference-counted like everything else, and cleaned up when no longer
used.
>
Only one answer: someone else can take care of the second question.

Extension modules CANNOT be deleted or reloaded, so it isn't possible to
reclaim the memory occupied by a shared library module containing such an
extension (without terminating the interpreter, which limits you somewhat
:-).

Sorry.

> 2) I am writing one function which takes a string, either multibyte or
> Unicode. I want to call PyArg_ParseTuple once, and have it convert the
> string passed into my desired output (n this case, Unicode). Some thing
> like: ParseTuple(args, "u", &ustr); But it appears that the interpreter
will
> not automatically do this for, or is there a way?
>

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list