-
Notifications
You must be signed in to change notification settings - Fork 438
Description
Summary of Problem
Description:
When compiling I received the error in the title.
Is this issue currently blocking your progress?
No, I can do the work in another language.
Steps to Reproduce
Source Code:
// main.chpl
use CTypes;
// Declare the external function signature in Chapel
extern proc passarray_cpp(array: c_float, size: c_int): c_int;
proc main() {
var a: [0..9] c_float;
var size: c_int = 10;
for i in 0..9 {
a[i] = (2.5 * i * i) : real(32);
}
writeln("Result from C++ function: ");
passarray_cpp(a, size);
}
// passarray.cpp (C++ implementation file)
#include "passarray.h"
#include <iostream>
using namespace std;
int passarray_cpp(float *array, int size) {
for (int i = 0; i < size; ++i) {
std::cout << "C++ array[" << i << "] = " << array[i] << "\n";
}
return 0;
}
// passarray.h
int passarray_cpp(float *array, int size);Compile command:
c++ -c -fPIC passarray.cpp
c++ -shared -o passarray.so passarray.o
chpl passarray.chpl passarray.h passarray.so
Execution command:
Did not compile.
Associated Future Test(s):
Configuration Information
-
Output of
chpl --version:
chpl version 2.6.0
built with LLVM version 19.1.7
available LLVM targets: xcore, x86-64, x86, wasm64, wasm32, ve, systemz, sparcel, sparcv9, sparc, riscv64, riscv32, ppc64le, ppc64, ppc32le, ppc32, nvptx64, nvptx, msp430, mips64el, mips64, mipsel, mips, loongarch64, loongarch32, lanai, hexagon, bpfeb, bpfel, bpf, avr, thumbeb, thumb, armeb, arm, amdgcn, r600, aarch64_32, aarch64_be, aarch64, arm64_32, arm64 -
Output of
$CHPL_HOME/util/printchplenv --anonymize:
CHPL_TARGET_PLATFORM: freebsd
CHPL_TARGET_COMPILER: llvm
CHPL_TARGET_ARCH: amd64
CHPL_TARGET_CPU: unknown
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none
CHPL_TASKS: fifo
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_TARGET_MEM: jemalloc
CHPL_ATOMICS: cstdlib
CHPL_GMP: bundled
CHPL_HWLOC: none
CHPL_RE2: bundled
CHPL_LLVM: system
CHPL_AUX_FILESYS: none -
Back-end compiler and version, e.g.
gcc --versionorclang --version:
FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)
Target: x86_64-unknown-freebsd13.5
Thread model: posix
InstalledDir: /usr/bin -
(For Cray systems only) Output of
module list: