A method and a casting mold for producing an optical semiconductor module
is provided, wherein a semiconductor body having at least one optically
active element on its top is introduced into a leadframe. Then conductive
connections are established between the semiconductor body and the
leadframe, and then the leadframe and semiconductor body are encapsulated
in a casting mold. Wherein provided in the part of the casting mold that
faces the top of the semiconductor body are masking bodies, which extend
from the top inner wall of the casting mold towards the optically active
elements and cover the elements with their respective end face in a way
that seals out casting material.