Skip to content

Implementation of "extern" functions in Kaleidoscope #69

Description

@inumanag

Hi,
I was trying to add support for "extern" functions from libc in Kaleidoscope (which come for free in C++ version of Kaleidoscope). However, for the following IR (trying to use sin from libc):

declare double @sin(double %f)
%calltmp = call double @sin(double 9.000000e+00)

I keep getting:

Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /tmp/llvm-5.0.0.src/include/llvm/Support/Casting.h, line 255.
Stacktrace:
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) LLVMSharp.LLVM.GetPointerToGlobal (LLVMSharp.LLVMExecutionEngineRef,LLVMSharp.LLVMValueRef) [0x00002] in <c6808a9c612144c69fe813302a5e9c29>:0

Will this require P/Invoke of any sort, or it is not doable from .NET framework as of now?
Btw. I am using MCJIT as specified in the tutorial.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions