Guoliang Jin
2010-Jul-22 02:52 UTC
[LLVMdev] How to add a GlobalVariable with type pthread_mutex_t
Hi, How can I add a GlobalVariable with type pthread_mutex_t into one module? Thanks, Guoliang
John McCall
2010-Jul-22 03:44 UTC
[LLVMdev] How to add a GlobalVariable with type pthread_mutex_t
On Jul 21, 2010, at 7:52 PM, Guoliang Jin wrote:> How can I add a GlobalVariable with type pthread_mutex_t into one module?There's no builtin LLVM abstraction which expands to pthread_mutex_t, so you'll have to encode its representation somehow: - You can run an LLVM-based C frontend (i.e. clang, llvm-gcc, or dragonegg) over C code that uses the type, then write code to build up that type manually. - You can build up a type based on what you can see in your system headers. - If your target is your host system, you can just pretend the type is an array of i8s of length sizeof(pthread_mutex_t) and with (say) pointer alignment. John.