I am trying to use "xerces-c" via FFI in Rust without success. In C++, I would write the following code to use it:
XMLPlatformUtils::Initialize();
{
XercesDOMParser domParser;
ParserErrorHandler parserErrorHandler;
domParser.setErrorHandler(&parserErrorHandler);
domParser.setDoSchema(true);
domParser.setValidationSchemaFullChecking(true);
domParser.parse(xmlFilePath.c_str());
if(domParser.getErrorCount() != 0) {
// ...
}
}
XMLPlatformUtils::Terminate();
How can I use these "complex" data types within Rust? I found many examples to export/create an FFI to use it in other languages but none to use complex types within Rust.
extern crate libc;
#[link(name = "xerces-c")]
extern {
// How do i have to implement the constructor here?
}
Rust doesn't support FFI with C++. If you want to use this library, you will have to find or write a translation layer that provides a pure C interface to the library, then bind to that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With