How can I call a C ++ constructor via Rust FFI?
I am trying to use "xerces-c" via FFI in Rust with no 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 in Rust? I found many examples for exporting / building FFI to use in other languages, but none have used complex types in Rust.
extern crate libc;
#[link(name = "xerces-c")]
extern {
// How do i have to implement the constructor here?
}
+3
source to share