Writing an Extension: 2 questions (so far)
sholden at holdenweb.com
Thu Jan 3 16:52:48 CET 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
> the C side when the user does a del <module>. What entry in the
> 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
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
> 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
> not automatically do this for, or is there a way?
More information about the Python-list