Pass -shared option to the linker as well.