Invisibility

Critical text on invisibility is found at:

DMG 59-60: “Invisibility”

DMG 70: “Invisible Opponents”

Coming out of invisibility to attack a charging target

If invisibility is broken in order to fire missiles at or otherwise attack a charging target, the creature which lost invisibility is a potential target of the charging creature.1) This is, in part, because a target does not need to be declared for a charge (E) or strike (G), only for spellcasting. See Combat Procedure for more detail.

Being targeted the round a creature becomes visible

A creature which has come out of invisibility can be attacked on that same round, assuming that an enemy's attack comes after the creature came out of invisibility.2) There is no rule that says otherwise. In practice, this means it could be potentially useful to lose initiative, though on the other hand, being able to attack first can have its own advantages, even if invisibility is lost.