December 15, 2015
On 2015-12-14 20:13, bachmeier wrote:
> Is it okay if I copy your post to the wiki at this link?
>
> http://wiki.dlang.org/Cookbook

Please don't. There's a lot of errors and weird things in the post. It doesn't really do what the title says. At least it's not interesting at all since it uses the C++ interface to call D, not the Objective-C interface. Which there is no reason to do, it could just use the C interface. No point in mixing C++ in the picture.

-- 
/Jacob Carlborg
December 15, 2015
On Tuesday, 15 December 2015 at 07:52:50 UTC, Jacob Carlborg wrote:
> Could you please add "-v" do the command line when compiling.

Mine was completely different:

$ dmd -v test.d
binary    dmd
version   v2.069
config    /usr/local/bin/dmd.conf
parse     test
importall main
import    object	(/Library/D/dmd/src/druntime/import/object.d)
semantic  main
entry     main      	test.d
semantic2 main
test.d(7): Error: undefined identifier 'selector'
test.d(13): Error: undefined identifier 'selector'
test.d(14): Error: undefined identifier 'selector'

Also, look what I have in my import/core folder. It doesn't match yours:

atomic.d      checkedint.d  demangle.d    internal/     memory.d      simd.d        sync/         thread.d      vararg.d
bitop.d       cpuid.d       exception.d   math.d        runtime.d     stdc/         sys/          time.d

So, then I uninstalled dmd via brew, but found it left a /Library/D folder behind. Therein lies the problem. So, I did sudo brew uninstall --force dmd, sudo su, removed the /Library/D folder, and then sudo brew install dmd. Now it works!

volomike:cpptod4 mike$ dmd -m64 -L-framework -LFoundation test.d
volomike:cpptod4 mike$ ls
test	test.d	test.o
volomike:cpptod4 mike$ ./test
2015-12-15 03:07:52.669 test[7308:116958] Hello World!
volomike:cpptod4 mike$






December 15, 2015
On 2015-12-15 09:08, Mike McKee wrote:
> On Tuesday, 15 December 2015 at 07:52:50 UTC, Jacob Carlborg wrote:
>> Could you please add "-v" do the command line when compiling.
>
> Mine was completely different:
>
> $ dmd -v test.d
> binary    dmd
> version   v2.069
> config    /usr/local/bin/dmd.conf
> parse     test
> importall main
> import    object    (/Library/D/dmd/src/druntime/import/object.d)
> semantic  main
> entry     main          test.d
> semantic2 main
> test.d(7): Error: undefined identifier 'selector'
> test.d(13): Error: undefined identifier 'selector'
> test.d(14): Error: undefined identifier 'selector'
>
> Also, look what I have in my import/core folder. It doesn't match yours:
>
> atomic.d      checkedint.d  demangle.d    internal/     memory.d
> simd.d        sync/         thread.d      vararg.d
> bitop.d       cpuid.d       exception.d   math.d        runtime.d
> stdc/         sys/          time.d
>
> So, then I uninstalled dmd via brew, but found it left a /Library/D
> folder behind. Therein lies the problem. So, I did sudo brew uninstall
> --force dmd, sudo su, removed the /Library/D folder, and then sudo brew
> install dmd. Now it works!

So a broken installer. I recommend using DVM [1]. It can install multiple versions of DMD and they live side by side completely independent.

> volomike:cpptod4 mike$ dmd -m64 -L-framework -LFoundation test.d
> volomike:cpptod4 mike$ ls
> test    test.d    test.o
> volomike:cpptod4 mike$ ./test
> 2015-12-15 03:07:52.669 test[7308:116958] Hello World!
> volomike:cpptod4 mike$

Cool :)

[1] https://github.com/jacob-carlborg/dvm

-- 
/Jacob Carlborg
December 15, 2015
On Tuesday, 15 December 2015 at 09:04:45 UTC, Jacob Carlborg wrote:
> On 2015-12-15 09:08, Mike McKee wrote:
>> On Tuesday, 15 December 2015 at 07:52:50 UTC, Jacob Carlborg wrote:
>>> Could you please add "-v" do the command line when compiling.
>>
>> Mine was completely different:
>>
>> $ dmd -v test.d
>> binary    dmd
>> version   v2.069
>> config    /usr/local/bin/dmd.conf
>> parse     test
>> importall main
>> import    object    (/Library/D/dmd/src/druntime/import/object.d)
>> semantic  main
>> entry     main          test.d
>> semantic2 main
>> test.d(7): Error: undefined identifier 'selector'
>> test.d(13): Error: undefined identifier 'selector'
>> test.d(14): Error: undefined identifier 'selector'
>>
>> Also, look what I have in my import/core folder. It doesn't match yours:
>>
>> atomic.d      checkedint.d  demangle.d    internal/     memory.d
>> simd.d        sync/         thread.d      vararg.d
>> bitop.d       cpuid.d       exception.d   math.d        runtime.d
>> stdc/         sys/          time.d
>>
>> So, then I uninstalled dmd via brew, but found it left a /Library/D
>> folder behind. Therein lies the problem. So, I did sudo brew uninstall
>> --force dmd, sudo su, removed the /Library/D folder, and then sudo brew
>> install dmd. Now it works!

Using sudo with homebrew is strongly recommended against (https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md#why-does-homebrew-say-sudo-is-bad- ). I have no idea how you got something in /Library/D, but it doubt it was from homebrew. In particular, if you weren't using root then I don't think homebrew would even be able to write there.

> So a broken installer.

Possible, but more likely a leftover from installing dmd some other way. Seems to be the case in 90% of "I installed dmd using X and it didn't work".

> I recommend using DVM [1]. It can install multiple versions of DMD and they live side by side completely independent.

The important thing is not to mix and match installers unless you know how they work.
December 15, 2015
On Tuesday, 15 December 2015 at 07:57:56 UTC, Jacob Carlborg wrote:
> On 2015-12-14 20:13, bachmeier wrote:
>> Is it okay if I copy your post to the wiki at this link?
>>
>> http://wiki.dlang.org/Cookbook
>
> Please don't. There's a lot of errors and weird things in the post. It doesn't really do what the title says. At least it's not interesting at all since it uses the C++ interface to call D, not the Objective-C interface. Which there is no reason to do, it could just use the C interface. No point in mixing C++ in the picture.

I removed the link to it, but I can't delete a wiki page.
December 16, 2015
On 2015-12-15 15:43, John Colvin wrote:

> I have no idea how you got something in /Library/D, but it doubt it
> was from homebrew.

The native installer installs into /Library/D.

> Possible, but more likely a leftover from installing dmd some other way.
> Seems to be the case in 90% of "I installed dmd using X and it didn't
> work".

Shouldn't an installer make sure the files it installed is the files being used?

> The important thing is not to mix and match installers unless you know
> how they work.

DVM will take precedence :)

-- 
/Jacob Carlborg
December 16, 2015
On Wednesday, 16 December 2015 at 07:46:53 UTC, Jacob Carlborg wrote:
> On 2015-12-15 15:43, John Colvin wrote:
>
>> I have no idea how you got something in /Library/D, but it doubt it
>> was from homebrew.
>
> The native installer installs into /Library/D.

Well that probably explains the problem then.

>> Possible, but more likely a leftover from installing dmd some other way.
>> Seems to be the case in 90% of "I installed dmd using X and it didn't
>> work".
>
> Shouldn't an installer make sure the files it installed is the files being used?

How exactly would it do that? I guess it could parse some output from dmd to check that it's looking in the right directories, that would be a nice enhancement.

I wouldn't want it to try and do much to fix the situation if it didn't work, that would be too intrusive.

>> The important thing is not to mix and match installers unless you know
>> how they work.
>
> DVM will take precedence :)

How does it do that?

DVM seems useful if you really need multiple versions of DMD installed, but in general I don't like having a special installer tool for each piece of software, each with its own way of doing things.
December 16, 2015
On 2015-12-16 10:19, John Colvin wrote:

> How exactly would it do that? I guess it could parse some output from
> dmd to check that it's looking in the right directories, that would be a
> nice enhancement.

Not sure, but for one thing, don't put any files any global directories. That is, don't put dmd.conf in /etc, don't put phobos in /usr/lib and so on.

> How does it do that?

It adds DMD to the beginning of the PATH environment variable and doesn't rely on any global files.

> DVM seems useful if you really need multiple versions of DMD installed,
> but in general I don't like having a special installer tool for each
> piece of software, each with its own way of doing things.

I can see the point of that. But with the current update rate of D and the fact it breaks my code in each single release, I think being able to have multiple versions of DMD installed is crucial.

Another advantage is that DVM is cross-platform. If you're using multiple platforms you can use the same way to install DMD on all the platforms.

-- 
/Jacob Carlborg
January 04
On Monday, 14 December 2015 at 10:09:29 UTC, Mike McKee wrote:
> I finally managed to get it working, using some help from this forum and stackoverflow.com, and a little bit of random luck with tests.
>
> [...]

Hello dlang forum,

I tried to replicate the shown, but I failed at the dmd compile stage. The dmd compiler for windows only puts out .obj files and no .o files. Is there another flag to set that makes the dmd compiler behave differently? Or is there another way to produce .o files from dlang source code?

Best regards pizza_dox_9999
January 05
On Thursday, 4 January 2024 at 14:17:01 UTC, pizza_dox_9999 wrote:
> On Monday, 14 December 2015 at 10:09:29 UTC, Mike McKee wrote:
>> I finally managed to get it working, using some help from this forum and stackoverflow.com, and a little bit of random luck with tests.
>>
>> [...]
>
> Hello dlang forum,
>
> I tried to replicate the shown, but I failed at the dmd compile stage. The dmd compiler for windows only puts out .obj files and no .o files. Is there another flag to set that makes the dmd compiler behave differently? Or is there another way to produce .o files from dlang source code?
>
> Best regards pizza_dox_9999

I haven't tried, but ldc2 may also be an option if dmd does not support this functionality.