[llvm-dev] LLVMGetBitcodeModuleInContext2 problem

Toshiyasu Morita via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 8 15:44:18 PST 2017


>
>
>         module_path = LLVMCreateMemoryBufferWithMemoryRange(path,
> strlen(path), "path", 1);
>

LLVMCreateMemoryBufferWithContentsOfFile takes a path.

Erm...no...the code is calling LLVMCreateMemoryBufferWithMemoryRange, not
LLVMCreateMemoryBufferWithContentsOfFile...

Or do you mean I need to load the module into memory before calling
LLVMGetBitcodeModuleInContext2?

Toshi


On Wed, Mar 8, 2017 at 3:40 PM, Friedman, Eli <efriedma at codeaurora.org>
wrote:

> On 3/8/2017 3:29 PM, Toshiyasu Morita via llvm-dev wrote:
>
>>
>> I'm trying to use LLVMGetBitcodeModuleInContext2 to load a .bc file.
>> However, it's not working.
>>
>> The code looks something like this:
>>
>> void llvm_load_IR_library(char *path)
>>
>> {
>>         LLVMContextRef global_context;
>>         LLVMMemoryBufferRef module_path;
>>         LLVMModuleRef ir_lib_module;
>>         bool flag;
>>
>>         module_path = LLVMCreateMemoryBufferWithMemoryRange(path,
>> strlen(path), "path", 1);
>>
>
> LLVMCreateMemoryBufferWithContentsOfFile takes a path.
>
> -Eli
>
> --
> Employee of Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
> Foundation Collaborative Project
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170308/a53ba2dc/attachment.html>


More information about the llvm-dev mailing list