Not 100% sure I understand the question or problem, but this ought to work, I think:
add_action( 'the_post', 'output_my_custom_field');
function output_my_custom_field( $post_object ) {
$post_id = $post_object->ID;
// why the conditional (and redundant !empty) ?
// if ( !empty($post_id) ) ) {
$my_custom_field = get_post_meta( $post_id, 'my_custom_field', true );
var_dump($my_custom_field);
// see above
// }
}