Cut eggplants in medium thick slices, sprinkle with salt and let soak for 20 min. Wash of the salt and dry with kitchen paper towels. Fry in enough good olive oil until light brown from both sides. Put them aside on paper towels to dry off some of the oil.
Cut onions in rings, fry the onion rings in the same oil until light brown. Add squeezed garlic and tomatoes and cook for 3 min. Add the coconut milk, add salt and pepper to taste. Stir constantly.
Put layer of eggplants in an ovenproof dish, cover with the sauce, add another layer eggplants, cover with sauce. Sprinkle with grated coconut.
Cover with foil and bake for 30 min. in the oven at around 350 F (180 C).