IA-32/AMD64 Disassembly Library

DynamoRIO can be used as a standalone library for IA-32/AMD64 disassembly, decoding, encoding, and general instruction manipulation, independently of controlling a target application. When used in this way, all aspects of DynamoRIO's API routines that apply to instrumentation or application control are not applicable; however, the full, rich instruction set API is enabled. For further information see the following sections of the Code Manipulation API:

Using DynamoRIO as a Standalone Library

DynamoRIO can be used as a regular third-party library for a standalone application (instead of a client that operates on a target program). In order to use the DynamoRIO API in such a situation, a dummy context must be created. This routine creates such a context, and initializes DynamoRIO for standalone use:

 dr_standalone_init() 

Note that the returned context cannot be used as the drcontext for a thread running under DynamoRIO control! It is only for standalone programs that wish to use DynamoRIO as a library of routines for IA-32 instruction manipulation or other purposes.

Since the DynamoRIO library on Windows includes or forwards implementations of certain C library routines (see C library utilities), standalone applications linking to both DynamoRIO and the C library may experience linker errors when building and floating point problems when running. To avoid these problems, explicitly list the C runtime library on the command line:

 /link /nodefaultlib libcmt.lib dynamorio.lib 

DynamoRIO writes to stderr and stdout using raw system calls, which can interfere with the buffering of library routines. When mixing use of printf or fprintf with DynamoRIO output (including not only dr_printf() and dr_fprintf() but also passing STDOUT or STDERR to routines like disassemble()), you may need to flush between library printing and DynamoRIO printing (e.g., using fflush(stdout)) to ensure that the library output is visible.

The binary tracedump reader (Use of Standalone API) is an example of use of DynamoRIO as a standalone library.

When building an application that uses DynamoRIO as a standalone library, follow the steps for Building a Client to include the header files and link with the DynamoRIO library, but omit the linker flags requesting no standard libraries or startup files. DynamoRIO's CMake support does this automatically via the configure_DynamoRIO_standalone() function.


  DynamoRIO API version 2.0.0 --- Thu Apr 22 00:18:19 2010