I have a program that works fine when I run it using C++ however, when I call it from my LLVM IR code it does not work.
Function (library/library.cpp)
extern "C" DLLEXPORT double *DOT(double A[3][3], double B[3][3]) {
std::cout << A[0][0] << std::endl;
...
}
LLVM IR (out.ll)
declare [3 x double] @DOT([3 x [3 x double]], [3 x [3 x double]])
...
%a1 = load [3 x [3 x double]], [3 x [3 x double]]* %a
%b2 = load [3 x [3 x double]], [3 x [3 x double]]* %b
%calltmp = call [3 x double] @DOT([3 x [3 x double]] %a1, [3 x [3 x double]] %b2)
I did not include the full program to save space but, if it is useful just ask and I will update the question.
Error (built)
[1] 3086 segmentation fault ./built
I use the following command to compile the code:
clang++ library/library.cpp out.ll -o built
Info
This works:
std::cout << A[0] << std::endl; // 0x1
This does not:
std::cout << A[0][0] << std::endl;