<pre class="notranslate">Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull", "hg update default", rebuild, and
retry
what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. Checkout the latest version of the Go code
2. Try to build a simple Hello World application:

package main

import "fmt"

func main() {
    fmt.Println("Hello")
}


What is the expected output?
The expected output is that Go will build the application.

What do you see instead?
The error: mkdir C:\Users\lmauldin\AppData\Local\Temp\go-build862896274\local\c:: The
filename, directory name, or volume label syntax is incorrect.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Windows 7 X64

Which revision are you using?  (hg identify)
50adb6a9e76c tip

Please provide any additional information below.
I think the latest changes to the Go cmd caused the problem because this was working
correctly yesterday morning (03/01/2012).</pre>
<p dir="auto">With the following code:</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package main

/*
#include &lt;stdlib.h&gt;
typedef void (*destructor)(void*);
static void my_func(destructor d, char *p) {
    d(p);
}
*/
import &quot;C&quot;

func main() {
    C.my_func(C.destructor(C.free), C.CString(&quot;test&quot;))
}"><pre class="notranslate"><span class="pl-k">package</span> main

<span class="pl-c">/*</span>
<span class="pl-c">#include &lt;stdlib.h&gt;</span>
<span class="pl-c">typedef void (*destructor)(void*);</span>
<span class="pl-c">static void my_func(destructor d, char *p) {</span>
<span class="pl-c">    d(p);</span>
<span class="pl-c">}</span>
<span class="pl-c">*/</span>
<span class="pl-k">import</span> <span class="pl-s">"C"</span>

<span class="pl-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-s1">C</span>.<span class="pl-en">my_func</span>(<span class="pl-s1">C</span>.<span class="pl-en">destructor</span>(<span class="pl-s1">C</span>.<span class="pl-c1">free</span>), <span class="pl-s1">C</span>.<span class="pl-en">CString</span>(<span class="pl-s">"test"</span>))
}</pre></div>
<p dir="auto">I get the following error:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ go build cgo_bug.go
# command-line-arguments
ld: illegal text-relocation to '_free' in /usr/lib/libpthread.dylib from 'main.init' in /var/folders/07/ks1g8j_n40v01c_gc7bzx_z00000gn/T//go-link-gyr5vG/go.o for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/usr/local/opt/go/libexec/pkg/tool/darwin_amd64/6l: running clang failed: unsuccessful exit status 0x100
$ go version
go version default darwin/amd64"><pre class="notranslate">$ go build cgo_bug.go
<span class="pl-c"><span class="pl-c">#</span> command-line-arguments</span>
ld: illegal text-relocation to <span class="pl-s"><span class="pl-pds">'</span>_free<span class="pl-pds">'</span></span> <span class="pl-k">in</span> /usr/lib/libpthread.dylib from <span class="pl-s"><span class="pl-pds">'</span>main.init<span class="pl-pds">'</span></span> <span class="pl-k">in</span> /var/folders/07/ks1g8j_n40v01c_gc7bzx_z00000gn/T//go-link-gyr5vG/go.o <span class="pl-k">for</span> architecture x86_64
clang: error: linker <span class="pl-c1">command</span> failed with <span class="pl-c1">exit</span> code 1 (use -v to see invocation)
/usr/local/opt/go/libexec/pkg/tool/darwin_amd64/6l: running clang failed: unsuccessful <span class="pl-c1">exit</span> status 0x100
$ go version
go version default darwin/amd64</pre></div>