Displaying 2 results from an estimated 2 matches for "filenminit".
Did you mean:
file_init
2020 Oct 01
3
Creating a global variable for a struct array
...abled assertions and the error seems to occur while creating GlobalVariable for both struct dhash and struct dlist.
Here is a simpler version of the code causing error:
//struct dhash
typedef struct dhash{
char* filenm;
int n;
}dhash;
//create global variable to hold filename string
Constant *filenmInit = ConstantDataArray::getString(M.getContext(), "myfile.txt");
Constant *filenmConst = new GlobalVariable(M, filenmInit->getType(), false,
GlobalVariable::ExternalLinkage, filenmInit, ".filenm");
//create global variable for int
Constant*...
2020 Oct 01
2
Creating a global variable for a struct array
Thank you very much. The code to initialize h1 to non-zero values was what I was looking for.
It's almost working except for a type mismatch wrt dlist* llist field of h1.
dlist static_lst[10] = { {1, 5, NULL}, ... };
dhash h1[10] = {{"myfile.txt", static_lst}, ... };
Along the lines of the code you had sent, I created a GlobalVariable* llist of type [10 x %struct.dlist]* for the