|
method returning a string insted of a pointer: msg#00105programming.swig
Hi, I've some problems converting with Swig (from C to Python) a function that returns a structure. The structure that "readSignedDocWrap" returns is "SignedDoc": typedef struct SignedDoc_st { char* szFormat; // data format name char* szFormatVer; // data format version int nDataFiles; DataFile** pDataFiles; int nSignatures; SignatureInfo** pSignatures; int nNotaries; NotaryInfo** pNotaries; } SignedDoc; The function "readSignedDocWrap" is: %inline %{ SignedDoc* readSignedDocWrap(const char* szFileName) { SignedDoc *pSignedDoc; readSignedDoc(&pSignedDoc, szFileName); .... return pSignedDoc; } %} The problem is that running this Python example: **example.py: python_object = mylib.readSignedDocWrap("hello.ddoc", 0) print python_object.nDataFiles ## works well print type(python_object.pDataFiles) ## says that pDataFiles is a "string" !!!! The second print says that "pDataFiles" is a string and not a pointer. How can I get, in the python example, the structure pointed by pDataFiles? The problem is the same with the field "pNotaries" and "pSignatures". Any ideas? thank you very much claudio _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Explicitly stating what to include in a class: 00105, Brian Matt |
|---|---|
| Next by Date: | Preventing a user to refer to non-existent struct members: 00105, Robert Lupton |
| Previous by Thread: | C++ static variable probi: 00105, Alexander Tournier |
| Next by Thread: | Preventing a user to refer to non-existent struct members: 00105, Robert Lupton |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |