Function definition


I want to define a function with basic block and so on.

I tried this:
Function *mmFn = new Function(FunctionType::get(Type::Int32Ty,Params,false), GlobalValue::ExternalLinkage, "___MM___", MainFn->getParent());
new BasicBlock("entry",mmFn);

At runtime I get a 'bus error'. Without the 'BasicBlock' it works a little bit. In the .ll code I can see the declaration of the function '___MM___' (but no definition).

I don't know what I forget to do. Perhaps somebody can help me ?

Thank you,