Creating array of structs being used in C interface
Timoses via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Nov 27 06:12:31 PST 2016
On Sunday, 27 November 2016 at 13:22:36 UTC, Nicholas Wilson
wrote:
>
> The missing symbol is the struct initialiser for
> neo4j_map_entry_t. Not sure why is not being generated (it
> should), possibly because of the union.
>
> That seems like a bug please report it. http://issues.dlang.org/
Thanks for the answer, Nicholas!
I've created a small example:
source/app.d
--------------------
import mytypes;
void main()
{
myunion[2] t;
}
--------------------
include/mytypes.d:
--------------------
module mytypes;
union myunion
{
double b;
};
--------------------
dub.json:
--------------------
"importPaths": ["include"]
--------------------
Output:
_____________________
dmd -c
-of.dub/build/application-debug-posix.osx-x86_64-dmd_2072-99D5F2E2DCAF9FF19FE5AE403C120D52/testomat.o -debug -g -w -version=Have_testomat -Iinclude source/app.d -vcolumns
Linking...
dmd
-of.dub/build/application-debug-posix.osx-x86_64-dmd_2072-99D5F2E2DCAF9FF19FE5AE403C120D52/testomat .dub/build/application-debug-posix.osx-x86_64-dmd_2072-99D5F2E2DCAF9FF19FE5AE403C120D52/testomat.o -g
Undefined symbols for architecture x86_64:
"_D7mytypes7myunion6__initZ", referenced from:
__Dmain in testomat.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to
see invocation)
Error: linker exited with status 1
FAIL
.dub/build/application-debug-posix.osx-x86_64-dmd_2072-99D5F2E2DCAF9FF19FE5AE403C120D52/ testomat executable
dmd failed with exit code 1.
_____________________
If I change the union's variable type to "int" (or any other) it
compiles just fine. So the problem seems to be the "double" value.
It also compiles just fine when I move "mytypes.d" into the
source/ folder (even with "double"!!!).
Should I still report it as a bug here: https://issues.dlang.org/
?
Or is it dub related?
More information about the Digitalmars-d-learn
mailing list