libbfd examples?
Nick Clifton
nickc@redhat.com
Mon Mar 18 16:18:43 GMT 2024
Hi Esteve,
> libbfd seems to be the library that I'm looking for for my purposes,
It is.
> but I'm finding it hard to figure out how to get started with using it.
> I'm looking to do something very simple to start with: Grab a windows
> PE file, and dump the contents of the .text section into a raw file.
Have a look in the binutils/ sub-directory of the binutils sources. There
are quite a few programs in there, some of which are quite simple and can give
you an indication of how to use the bfd library.
For example binutils/size.c is the source for the 'size' program and its
functions display_file() and display_bfd() are a nice simple example of how
to load a file, use the bfd library to scan it and then close things down
afterwards.
Cheers
Nick
More information about the Binutils
mailing list