See

https://github.com/radare/radare2/commit/2cbce80f2fa94a610c7b6c5a0f00bdba2d04f09b

 :)

On 06/18/13 11:06, pancake wrote:
r2 is written in C, so you have to tell this to your compiler in order
to avoid name mangling of function names and so on.

Correct file would be:

#include <string>
extern "C" {
#include <r_bin.h>
}


int main(){
     std::string file = "a_file.exe";
     RBin *test = r_bin_new();
     r_bin_load (test, file.c_str(), R_FALSE);

}


---

maybe we can add those statements in the include files directly, so you
will not need to manually specify this.

thanks for noticing.

On 06/18/13 01:30, Adam Pridgen wrote:
Hello,

I have been trying to use libr from C++, but I am having trouble linking
my program with libr_bin.so.  I have installed libr, r2-bindings, and
radare2 from source in the /usr/ directory.

Here is the compiler command that I am using:

g++ -Wall -g  -I/usr/include/libr/  -L/usr/lib/ -o load_bin_file.o
-lr_bin  load_bin_file.cpp

and here is the basic program I am using:

 > === load_bin_file.cpp

#include <string>
#include <r_bin.h>


int main(){
     std::string file = "a_file.exe";
     RBin *test = r_bin_new();
     r_bin_load (test, file.c_str(), R_FALSE);

}

 > ===


I am coming up short on reasons why the compilation is failing.  Any
help would be greatly appreciated.  Thanks,

-- Adam


_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org


_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org


_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org

Reply via email to