Resolve #119 and enhance ELF Python bindings

This commit is contained in:
Romain Thomas
2018-06-08 10:48:29 +02:00
parent 163cd3bcc9
commit cd1cc457cf
63 changed files with 405 additions and 183 deletions
+9 -3
View File
@@ -19,11 +19,15 @@
#include <string>
void init_ELF_Parser_class(py::module& m) {
namespace LIEF {
namespace ELF {
template<>
void create<Parser>(py::module& m) {
// Parser (Parser)
m.def("parse",
static_cast<Binary* (*) (const std::string&, DYNSYM_COUNT_METHODS)>(&Parser::parse),
static_cast<std::unique_ptr<Binary> (*) (const std::string&, DYNSYM_COUNT_METHODS)>(&Parser::parse),
"Parse the given binary and return a " RST_CLASS_REF(lief.ELF.Binary) " object\n\n"
"For *weird* binaries (e.g sectionless) you can choose the method to use to count dynamic symbols "
" (" RST_CLASS_REF(lief.ELF.DYNSYM_COUNT_METHODS) ")",
@@ -31,7 +35,7 @@ void init_ELF_Parser_class(py::module& m) {
py::return_value_policy::take_ownership);
m.def("parse",
static_cast<Binary* (*) (const std::vector<uint8_t>&, const std::string&, DYNSYM_COUNT_METHODS)>(&Parser::parse),
static_cast<std::unique_ptr<Binary> (*) (const std::vector<uint8_t>&, const std::string&, DYNSYM_COUNT_METHODS)>(&Parser::parse),
"Parse the given binary and return a " RST_CLASS_REF(lief.ELF.Binary) " object\n\n"
"For *weird* binaries (e.g sectionless) you can choose the method to use to count dynamic symbols "
" (" RST_CLASS_REF(lief.ELF.DYNSYM_COUNT_METHODS) ")",
@@ -76,3 +80,5 @@ void init_ELF_Parser_class(py::module& m) {
"name"_a = "",
py::return_value_policy::take_ownership);
}
}
}