You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
Passing a variable of type unmanaged C? to an extern proc causes the compiler to assume that the class is local.
Is this issue currently blocking your progress?
No. Presumably the reason this has not come up much is that Chapel classes can't really be passed to C code (since we don't have a way of giving C the details of the type). They can be passed if cast to C void pointers, but the code looks different with such a cast (and works correctly).
We noticed this problem when making adjustments to a future in #26417 and #26476.
Steps to Reproduce
Source Code:
use CTypes;
externproc sizeof(x):c_size_t;
class C {
var x:int;
}
proc main() {
var c:unmanaged C?;
onLocales[numLocales-1] {
writeln("allocating c on locale ", here);
c =newunmanaged C(1);
}
sizeof(c); // it works if this line is commented outwriteln(c.locale);
}
chpl program.chpl && ./program -nl 2
produces
allocating c on locale LOCALE1
LOCALE0
but I would expect it to produce
allocating c on locale LOCALE1
LOCALE1
Compile command:
see above
Execution command:
see above
Associated Future Test(s):
TODO
Configuration Information
A multi-locale configuration of Chapel. When writing this issue I was using quickstart+gasnet (local oversubscribed) and 2.4.0 pre-release.
The text was updated successfully, but these errors were encountered:
Summary of Problem
Description:
Passing a variable of type
unmanaged C?
to an extern proc causes the compiler to assume that the class is local.Is this issue currently blocking your progress?
No. Presumably the reason this has not come up much is that Chapel classes can't really be passed to C code (since we don't have a way of giving C the details of the type). They can be passed if cast to C void pointers, but the code looks different with such a cast (and works correctly).
We noticed this problem when making adjustments to a future in #26417 and #26476.
Steps to Reproduce
Source Code:
produces
but I would expect it to produce
Compile command:
see above
Execution command:
see above
Associated Future Test(s):
TODO
Configuration Information
A multi-locale configuration of Chapel. When writing this issue I was using quickstart+gasnet (local oversubscribed) and 2.4.0 pre-release.
The text was updated successfully, but these errors were encountered: