Re: dmd linker (OPTLINK) gives Error 42: Symbol Undefined when using extern

2011-12-25 Thread Jakob Ovrum
On Sunday, 25 December 2011 at 22:46:33 UTC, Joshua Reusch wrote: public string some_var = "Hello, world!"; It's important to note that public is the default access level here.

Re: dmd linker (OPTLINK) gives Error 42: Symbol Undefined when using extern

2011-12-25 Thread Joshua Reusch
Am 25.12.2011 22:37, schrieb Tal: I want to save the hInstance of WinMain so I would be able to use it later in some other module. So how do I accomplish that ? If you don't know: You can also get the HINSTANCE with GetModuleHandle(NULL);

Re: dmd linker (OPTLINK) gives Error 42: Symbol Undefined when using extern

2011-12-25 Thread Joshua Reusch
Am 25.12.2011 23:26, schrieb Tal: I'm quite new to this language, could you please provide a short snippet of code to clarify ? --- a.d: import std.stdio; import b; void main() { writeln("some_var from Module b: \"", b.some_var, "\""); } --- b.d: public string some_var = "Hello, world!";

Re: dmd linker (OPTLINK) gives Error 42: Symbol Undefined when using extern

2011-12-25 Thread Tal
I'm quite new to this language, could you please provide a short snippet of code to clarify ?

Re: dmd linker (OPTLINK) gives Error 42: Symbol Undefined when using extern

2011-12-25 Thread Joshua Reusch
Am 25.12.2011 22:37, schrieb Tal: I want to save the hInstance of WinMain so I would be able to use it later in some other module. So how do I accomplish that ? just define a public variable in the global scope.

Re: dmd linker (OPTLINK) gives Error 42: Symbol Undefined when using extern

2011-12-25 Thread Tal
I want to save the hInstance of WinMain so I would be able to use it later in some other module. So how do I accomplish that ?

Re: dmd linker (OPTLINK) gives Error 42: Symbol Undefined when using extern

2011-12-25 Thread Andrej Mitrovic
You can't prototype D functions like that, they belong to a module. test is built as _D1b4testFZAya, not _D1a4testFZAya (notice the module names, a and b after _D1). What exactly are you trying to do? DLLs?

dmd linker (OPTLINK) gives Error 42: Symbol Undefined when using extern

2011-12-25 Thread Tal
Linking the following two files gives me a link-error: a.d: import std.stdio; extern (D) string test (); void main() { writeln(test()); readln(); } b.d: string test () {

Re: GetAndSet function (corresponding to cas function)

2011-12-25 Thread Adrian Mercieca
On Sun, 25 Dec 2011 13:37:32 +0100, Mike Wey wrote: > On 12/25/2011 09:25 AM, Adrian Mercieca wrote: >> Hi folks, >> >> Is there a GetAndSet function (corresponding to cas (compare and set) >> function) in D? >> >> Thanks. > > core.atomic.cas > > http://dlang.org/phobos/core_atomic.html#cas I k

Re: GetAndSet function (corresponding to cas function)

2011-12-25 Thread Mike Wey
On 12/25/2011 09:25 AM, Adrian Mercieca wrote: Hi folks, Is there a GetAndSet function (corresponding to cas (compare and set) function) in D? Thanks. core.atomic.cas http://dlang.org/phobos/core_atomic.html#cas -- Mike Wey

Re: Reading about D: few questions

2011-12-25 Thread Denis Shelomovskij
25.12.2011 0:48, Mr. Anonymous пишет: Actually, when I think of it: int a_orig = a++; int[] arr_orig = arr[]++; Should be read as: int a_orig = a; ++a; int[] arr_orig = arr[]; ++arr[]; (If I'm not mistaken, it was written in the TDPL book) Which means no copy of arr is made, and both arrays

GetAndSet function (corresponding to cas function)

2011-12-25 Thread Adrian Mercieca
Hi folks, Is there a GetAndSet function (corresponding to cas (compare and set) function) in D? Thanks.