Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
go env Output
set CGO_CFLAGS=-g -O2
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\anon\AppData\Local\Temp\go-build481521658=/tmp/go-build -gno-record-gcc-switches
The archive is linked against a C which just calls test() with:
gcc main.c -L<path to dll folder> -l<dll name without extension> -o test.exe
Executing test.exe does not produce any output.
What did you expect to see?
A valid dll file (standard dynamic library format on windows)
What did you see instead?
The call go build -buildmode=c-shareddoes not yield a valid dll (I think; it does not have any extension by default). It produces a [folder name] file without any extension.
I'm not sure what happens, but if you try to link it against a C mainthe main function does not get executed. The linker does not produce any warnings or errors about the file (after renaming [name] to [name].dll).
If you produce the archive with go build -buildmode=c-shared -o <name>.dll everything works as expected, but go build -buildmode=c-shared should be sufficient, but it isn't.
The text was updated successfully, but these errors were encountered:
@alexbrainman that was the point of the bug report, because it should output a file with an extension. It's not common for shared objects or dynamic linked libraries to have no extension. On linux the should end with .so and on windows they should (per default) end with .dll.
Apart from this, if you don't specify the name with the -o flag, the compiler does not create a valid .dll on windows (Later linkage fails).
@alexbrainman What do you mean with you cannot rename output files? I think it's a simple code line of the go tool, which must be changed to get file extensions. -o for example could default to [packagename].so instead of [packagename]. on linux and [packagename].dll on windows.