Earlier I commented here on this blog on the sources for international law. While the hierarchy is important and first we search for treaties/conventions on a relevant question, all these sources interact and collide. For example, I would like to compare the treaties with domestic contracts for a moment. Treaties are similar to regular contracts between domestic parties except that they may become binding even for those who have not expressly entered into them. Isn't that a strange concept? Isn't consent after all important in international law?
Insofar as treaties may over time turn into customary international law, they may in fact become binding on those who withheld consent to them and never signed on those treaties. As far as how certain treaties turn into customary international law, that is a complex issue that needs separate discussion. But the International Court expressed this well in the case of North Sea Continental Shelf (with respect to Article 6 of the 1958 Geneva Convention):
... [the view] clearly involves treating that Article as a norm-creating provision which has constituted the foundation of, or has generated a rule which, while only conventional or contractual in its origin, has since passed into the general corpus of international law, and is now accepted as such by the opinio juris, so as to have become binding even for countries which have never, and do not become parties to the Convention. There is no doubt that this process is a perfectly possible one and does from time to time occur: it constitutes indeed one of the recognized methods by which new rules of customary international law may be formed.
But all this is a highly political and policy-based process. Therefore, at a given time there are always those who try to assert that a given treaty never turned into customary international law because of various reasons. One reason would be that there was no proof of widespread practice of international actors abiding by the principle set out in the treaty. However, in cases applying jus cogens, norms that are not dependent on consent of parties-- genocide, war crimes, crimes against humanity-- no party really can try to win these arguments.
Also, it must be kept in mind that interpretation of treaties becomes important. Given the reservations, understandings, and declarations that states add-on to their signatures on treaties, similar to domestic contractual disputes the courts are asked to interpret the application of a treaty rule on a specific case. The court then will look not only to the other sources of international law, but also to the national courts of the disputing parties and their interpretations of that treaty... It is a very complex and live process that often does not render desirable results and subvert the very principles of the given treaty.