Extension C module
jslove at my-deja.com
jslove at my-deja.com
Tue Mar 7 14:03:55 EST 2000
More information about the Python-list mailing list
Tue Mar 7 14:03:55 EST 2000
- Previous message (by thread): Extension C module
- Next message (by thread): Python for non-programmers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I got it to work! Looks like a cryptic combination of compiler directives did it. So, I'm using an import library created by COFF2OMF, and the following compiler directives are used. (I don't know about builder 4, but in Builder 3, in the project options dialog box, on the directives tab, their is a text box where you just paste these.) BI_NAMESPACE;_NO_VCL;INC_OLE2;_OCFDLL;_RTLDLL;_BIDSDLL;_AFXDLL;_X86_;_WI NDOWS;_MSC_VER=900;_AFX_PORTABLE;_AFX_NOFORCE_LIBS;_CRT_PORTABLE;_AFX_NO _DEBUG_CRT;_OCFPCH I don't know which one does the trick. If you need me to isolate it, I'll give it a try. Let me know if this works for you. Jay Love In article <89vbcb$10i$1 at nnrp1.deja.com>, vmarkwart at my-deja.com wrote: > Hi, > A couple of strange things. The extension module I'm (attempting) to > write (Borland's C++ Builder 4) has a couple of little flaws. > > When I include > Py_INCREF(Py_None); > return Py_None; > in a procedure which returns no value, it compiles correctly but > returns a memory exception error when imported and run, and crashes > Python (not a happy sight). When I leave those lines out and return an > empty string the function can be called happily from Python, but > returns an unloved, unwanted empty string. Any ideas on what I'm doing > wrong.? > > Also, I have another function which returns a dictionary of values, eg > >>> import pytools > >>> pytools.volumeInfo("f:\\") > {'filenameUnicode': 'supported', 'filenameMaxLength': '255', > 'volumeName': 'SYS', 'filenameCase': 'preserved', 'volumeCompression': > 'compressed', 'filenameCompression': 'supported', 'volumeSerialNumber': > '1628725518', 'filesystemName': 'NWFS', 'filenameCaseSensitivity': > 'caseSensitive', 'filesystemACLs': 'supported'} > > In interactive mode everything looks fine, but when run in a script it > comes back with the error: > Traceback (innermost last): > File "<stdin>", line 1, in ? > File "pytoolstest.py", line 32, in ? > vinfo = pytools.volumeInfo(drive) > TypeError: argument 1: expected string without null bytes, string found > > Any clues as to where to start looking? I've commented out virtually > everything in the function, and I still get the error. > > If anyone wants the sourcecode, please email me at > vmarkwart at hotmail.com > Cheers > Victor > > Sent via Deja.com http://www.deja.com/ > Before you buy. > Sent via Deja.com http://www.deja.com/ Before you buy.
- Previous message (by thread): Extension C module
- Next message (by thread): Python for non-programmers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list