If you're not planning on being gainfully employed (i.e., salaried) in Madagascar (you can always get contracts in other countries), then you should look at the Malagasy embassy web site for the different types of visas, particularly "Regroupement Familial". First, you need to get an extendable visa with this intention. It's still a bit of a hassle as you'll have to renew it after 1, 2, 5, and ten years, but you can do that here.