This is generally not recommended if you're not sure what you are doing, since it can open a lot of security holes, and it is best to only call contracts that are known beforehand.
That said, the technique looks like this:
address myContract = 0xabcdef....;
myContract.call.gas(msg.gas-3000).value(1 ether)(bytes4(sha3("myFunction(uint256,bytes32,string)")), 42, 0xabc, "hello")
Essentially, you use the call
method of an address, then use the gas
and value
properties to add gas and value (you may ommit the value if it is 0). Then you pass in the first 4 bytes of the sha3 hash of the function you wish to call.