Generate correct code for effectful ForeignImports.