Structure declaration with IR builder

Hi All,
I tryed to create a global structured derived declaration in my compiler by:
StructType *st = StructType(getGlobalContext(), elements, false);

In dump module i didn't find any code needed to declare a new user data type.

Is there a instruction to add this class into current module?

Cheers,
Manuele

Hi,

that's what I'm doing ...

//Init the struct type
  llvm::StructType *structReg = llvm::StructType::create(TargetModule->getContext(),vMember, "struct.Foo");
  structRegPtr = llvm::PointerType::get(structReg, 0);

//Create a llvm function
    llvm::FunctionType* ty = llvm::FunctionType::get(llvm::Type::getInt32Ty(TargetModule->getContext()),structRegPtr,false);
    llvm::Constant *c = TargetModule->getOrInsertFunction(BB.getBlockName(),ty);
    fTest = llvm::cast<llvm::Function>(c);
    fTest ->setCallingConv(llvm::CallingConv::C);

//Access the struct members
llvm:Value *ArgValuePtr = builder->CreateStructGEP(fTest ->arg_begin(),0,"ptrMember1");
llvm::Valuie *StructValue = builder->CreateLoad(ArgValuePtr,false,"member1");

Cheers,
Peter

Peter Garba - Software Engineer - +49 (0)89 894221 190 - Peter.Garba@safenet-inc.com

It doesn't seem to show up until it's referred to by something else.