[llvm-dev] Creating a global variable for a struct array
Niddodi, Chaitra via llvm-dev
llvm-dev at lists.llvm.org
Tue Sep 22 15:52:50 PDT 2020
Hello,
I would like to create a global variable for the following struct array, h1
dhash* h1 = new dhash[10];
typedef struct dhash{
char* filenm;
dlist* llist;
}dhash;
typedef struct dlist{
int soffst;
int eoffst;
uint8_t* dptr;
}dlist;
I also need to allocate space for:
1) the field llist in struct dhash which is a pointer to another struct dlist and
2) the field dptr in struct dlist
Is there an example that I can refer to for doing this ?
I tried to create a GlobalVariable using ConstantStruct::get(StructType*, ArrayRef<Constant *>). I'm not sure how to get the second argument of type ArrayRef<Constant *> from the above variable h1.
Thanks,
Chaitra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200922/ff31f363/attachment-0001.html>
More information about the llvm-dev
mailing list