We study the special algebraic properties of alternating 3-forms in 6 dimensions and introduce a diffeomorphism-invariant functional on the space of differential 3-forms on a closed 6-manifold M. Restricting the functional to a de Rham cohomology class in H3(M, R), we find that a critical point which is generic in a suitable sense defines a complex threefold with trivial canonical bundle. This approach gives a direct method of showing that an open set in H3(M, R) is a local moduli space for this structure and introduces in a natural way the special pseudo-Kähler structure on it.