Re: [racket-users] FFI Trouble (file streams, variadic functions)

2018-08-27 Thread Neil Van Dyke
Philip McGrath wrote on 08/27/2018 11:12 AM: What I'm currently exploring, though, is writing a helper program in Racket using the FFI. It will probably read a list of paths from standard in and write a hash table to standard out mapping each path to its validation result. I still plan to run

Re: [racket-users] FFI Trouble (file streams, variadic functions)

2018-08-27 Thread Philip McGrath
That is extremely good advice that I absolutely intend to follow. Here's a bit about what I'm doing: At Digital Ricoeur (https://digitalricoeur.org/), we have a corpus of hundreds of XML documents and growing, some of them book-length. These must be validated against a custom DTD that is derived

Re: [racket-users] FFI Trouble (file streams, variadic functions)

2018-08-27 Thread Neil Van Dyke
Rather than use FFI, would it work for your purposes to have the libxml2 code in a separate process from Racket?  That would avoid the likely C memory bugs corrupting your Racket process. https://www.cvedetails.com/vulnerability-list/vendor_id-1962/product_id-3311/Xmlsoft-Libxml2.html I've

Re: [racket-users] FFI Trouble (file streams, variadic functions)

2018-08-27 Thread Ryan Culpepper
I didn't know before I tried it either. It occurred to me as a candidate because I've seen many warnings about conflating ordinary pointers and function pointers (although usually the warning is that they are not guaranteed to have the same size). I only discovered that note in the docs

Re: [racket-users] FFI Trouble (file streams, variadic functions)

2018-08-27 Thread Philip McGrath
Thanks for the very quick reply—using `_fpointer` seems to work for me, too. I don't think I'd noticed it in the docs before, though, even if I had, I don't think it would have been obvious to me that it was the solution to this problem. -Philip On Mon, Aug 27, 2018 at 8:03 AM Ryan Culpepper

Re: [racket-users] FFI Trouble (file streams, variadic functions)

2018-08-27 Thread Ryan Culpepper
On 08/27/2018 02:13 PM, Philip McGrath wrote: I am hoping for some help debugging a problem I'm having writing FFI bindings for libxml2. I am trying to use the function `xmlValidateDtd`, which (predictably) validates an XML document against a DTD. To support error reporting, the first

[racket-users] FFI Trouble (file streams, variadic functions)

2018-08-27 Thread Philip McGrath
I am hoping for some help debugging a problem I'm having writing FFI bindings for libxml2. I am trying to use the function `xmlValidateDtd`, which (predictably) validates an XML document against a DTD. To support error reporting, the first argument to the function is a pointer to an