Opening and Closing BFDs
========================

bfd_openr
.........

Opens the file supplied (using fopen) with the target supplied, it returns a pointer to the created BFD.

If NULL is returned then an error has occured. Possible errors are no_memory, invalid_target or system_call error.

     bfd* bfd_openr(CONST char *filename,CONST char*target);

bfd_fdopenr
...........

bfd_fdopenr is to bfd_fopenr much like  fdopen is to fopen. It opens a BFD on a file already described by the FD supplied.

Possible errors are no_memory, invalid_target and system_call error.

     bfd * bfd_fdopenr(CONST char *filename, CONST char *target, int fd);

bfd_openw
.........

Creates a BFD, associated with file FILENAME, using the file format TARGET, and returns a pointer to it.

Possible errors are system_call_error, no_memory, invalid_target.

     bfd * bfd_openw(CONST char *filename, CONST char *target);

bfd_close
.........

This function closes a BFD. If the BFD was open for writing, then pending operations are completed and the file written out and closed. If the created file is executable, then chmod is called to mark it as such.

All memory attached to the BFD's obstacks is released.

true is returned if all is ok, otherwise false.

     boolean bfd_close(bfd *);

bfd_create
..........

This routine creates a new BFD in the manner of bfd_openw, but without opening a file. The new BFD takes the target from the target used by TEMPLATE. The format is always set to bfd_object.

     bfd * bfd_create(CONST char *filename, bfd *template);

bfd_alloc_size
..............

Return the number of bytes in the obstacks connected to the supplied BFD.

     bfd_size_type bfd_alloc_size(bfd *abfd);