A non-boundary conforming formulation for simulating complex flows with moving solid boundaries on fixed Cartesian grids is proposed. The direct forcing immersed boundary method (IBM) is implemented in a direct numerical simulation (DNS) code (called Incompact3d) based on high-order compact schemes for incompressible flows. To satisfy the boundary conditions on the immersed interface, the velocity field at the grid points near the interface is reconstructed via momentum forcing on a Cartesian grid by means of interpolation at forcing points in the fluid domain. A novel interpolation scheme which is applicable to boundaries of arbitrary shape is introduced and compared to a bi-linear model. A variance of this method utilizes a more compact stencil which allows compatibility with 2D domain decomposition of the DNS code. Local force distributions and velocity fields were compared to identify which interpolation scheme best represents the solid boundaries by computing flow induced by a transversely oscillating cylinder. The accuracy and efficiency of the present technique are examined by simulating 2D flow over a traveling wavy foil and comparing against numerical reference data. Finally, we present results from a 3D simulation of a lamprey-like body undulating with prescribed experimental kinematics of anguilliform type, in order to demonstrate the ability of the present implementation in computing flows around moving solid objects with non-trivial geometries.