Re: How to setup DLL and EXE projects in one VS solution

2017-05-18 Thread Rainer Schuetze via Digitalmars-d-learn
On 17.05.2017 18:56, Igor wrote: At the moment I have: EXEProject: app.d - it does loadlibrary of dllproj and uses data structures defined in dllproj.d (it imports dllproj). On the file system this file is under /platform/win32/ and is defined as module win32.app; DLLProject dllproj.d -

Re: How to setup DLL and EXE projects in one VS solution

2017-05-18 Thread MGW via Digitalmars-d-learn
On Wednesday, 17 May 2017 at 19:48:42 UTC, Igor wrote: On Wednesday, 17 May 2017 at 18:03:04 UTC, Igor wrote: What exactly do mean by "binding"? Also I am wondering if using extern(C) as opposed to extern(D) only affects name mangling or am I losing some DLang possibilities since I am only

Re: How to setup DLL and EXE projects in one VS solution

2017-05-18 Thread Igor via Digitalmars-d-learn
On Thursday, 18 May 2017 at 07:10:54 UTC, Rainer Schuetze wrote: You have to add an import path to the folder with dllproj inside to the project configuration of the exeproject. If you want to limit the imported code to the declarations, you can enable "generate interface headers" and add

Re: How to move append to an array?

2017-05-18 Thread biocyberman via Digitalmars-d-learn
On Monday, 15 May 2017 at 21:38:52 UTC, Yuxuan Shui wrote: Suppose I have a struct A { @disable this(this); } x; How do I append it into an array? Do I have to do array.length++; moveEmplace(x, array[$-1]); ? Judging form the way you write the struct. It is of C/C++ style. With that

Re: Fails to use testFilename in unittest

2017-05-18 Thread biocyberman via Digitalmars-d-learn
This is the compile error message by the way: dmd -unittest ./testFile.d

Fails to use testFilename in unittest

2017-05-18 Thread biocyberman via Digitalmars-d-learn
There is a ongoing discussion about temp file over here: http://forum.dlang.org/thread/sbehcxusxxibmpkae...@forum.dlang.org I have a question about generating a temporary file to write test data. I can create my own file and use it but just want to use the existing tool for convenience.

Re: Fails to use testFilename in unittest

2017-05-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, May 18, 2017 09:40:33 biocyberman via Digitalmars-d-learn wrote: > There is a ongoing discussion about temp file over here: > http://forum.dlang.org/thread/sbehcxusxxibmpkae...@forum.dlang.org > > I have a question about generating a temporary file to write test > data. I can create

Re: How to setup DLL and EXE projects in one VS solution

2017-05-18 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 18 May 2017 at 07:53:02 UTC, Igor wrote: I tried just adding import paths to project and to di files and although compilation passes I still get link errors like: error LNK2019: unresolved external symbol _D10handmade_h10game_input6__initZ (handmade_h.game_input.__init)

alias this and struct initializer

2017-05-18 Thread Andre Pany via Digitalmars-d-learn
Hi, I have some issues with struct initializer and alias this. In following example 1 and 2 is working but there is a syntax error for 3. I think as case 2 is working case 3 should work also. For me case 3 is looking much nicer than case 1. What do you think? void main() { // Working

Re: Cheetah: Keeping track of multiple connected clients

2017-05-18 Thread aberba via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 21:56:16 UTC, aberba wrote: On Tuesday, 16 May 2017 at 17:49:07 UTC, bauss wrote: [...] It really awesome the way you responded quickly. About targeting a client, suppose I have clients A, B, and C. Message can be broadcast to all using above solution. But in

Re: Fails to use testFilename in unittest

2017-05-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, May 18, 2017 09:56:36 biocyberman via Digitalmars-d-learn wrote: > On Thursday, 18 May 2017 at 09:49:26 UTC, Jonathan M Davis wrote: > > On Thursday, May 18, 2017 09:40:33 biocyberman via > > > > Digitalmars-d-learn wrote: > >> [...] > > > > Actually, it's not used all over the place

Re: Fails to use testFilename in unittest

2017-05-18 Thread biocyberman via Digitalmars-d-learn
On Thursday, 18 May 2017 at 09:49:26 UTC, Jonathan M Davis wrote: On Thursday, May 18, 2017 09:40:33 biocyberman via Digitalmars-d-learn wrote: [...] Actually, it's not used all over the place in Phobos. It's only used std.stdio, where it's a private function in a version(unittest) block.

Re: Cheetah: Keeping track of multiple connected clients

2017-05-18 Thread bauss via Digitalmars-d-learn
On Thursday, 18 May 2017 at 11:44:57 UTC, aberba wrote: On Tuesday, 16 May 2017 at 21:56:16 UTC, aberba wrote: On Tuesday, 16 May 2017 at 17:49:07 UTC, bauss wrote: [...] It really awesome the way you responded quickly. About targeting a client, suppose I have clients A, B, and C. Message

Re: How to setup DLL and EXE projects in one VS solution

2017-05-18 Thread Rainer Schuetze via Digitalmars-d-learn
On 18.05.2017 09:53, Igor wrote: On Thursday, 18 May 2017 at 07:10:54 UTC, Rainer Schuetze wrote: You have to add an import path to the folder with dllproj inside to the project configuration of the exeproject. If you want to limit the imported code to the declarations, you can enable

Re: alias this and struct initializer

2017-05-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 18 May 2017 at 08:40:39 UTC, Andre Pany wrote: I think as case 2 is working case 3 should work also. Nope, case 2 is assigning to an already constructed object and case 3 is constructing a new one. alias this is NEVER used in construction. It can only apply after the object

Re: Fails to use testFilename in unittest

2017-05-18 Thread biocyberman via Digitalmars-d-learn
On Thursday, 18 May 2017 at 10:05:41 UTC, Jonathan M Davis wrote: On Thursday, May 18, 2017 09:56:36 biocyberman via Digitalmars-d-learn wrote: [...] My point is that it's a private function for testing std.stdio and not intended to be part of the public API or be used by anyone else (it's

Re: How to setup DLL and EXE projects in one VS solution

2017-05-18 Thread Igor via Digitalmars-d-learn
On Thursday, 18 May 2017 at 18:00:02 UTC, Rainer Schuetze wrote: That's what I meant with "other cross module dependencies". In this case it might work if you export _D10handmade_h10game_input6__initZ from your DLL with the help of a def-file, but that's not something that scales well.

How to check a struct exists at a particular memory address?

2017-05-18 Thread Gary Willoughby via Digitalmars-d-learn
This might be a really silly question but: I've allocated some memory like this (Foo is a struct): this._data = cast(Foo*) calloc(n, Foo.sizeof); How can I then later check that there is a valid Foo at `this._data` or `this._data + n`?

Re: How to check a struct exists at a particular memory address?

2017-05-18 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 18 May 2017 at 20:20:47 UTC, Gary Willoughby wrote: This might be a really silly question but: I've allocated some memory like this (Foo is a struct): this._data = cast(Foo*) calloc(n, Foo.sizeof); How can I then later check that there is a valid Foo at `this._data` or

Re: How to check a struct exists at a particular memory address?

2017-05-18 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 18 May 2017 at 21:09:06 UTC, Igor wrote: On Thursday, 18 May 2017 at 20:20:47 UTC, Gary Willoughby wrote: This might be a really silly question but: I've allocated some memory like this (Foo is a struct): this._data = cast(Foo*) calloc(n, Foo.sizeof); How can I then later

Re: alias this and struct initializer

2017-05-18 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 18 May 2017 at 12:56:09 UTC, Adam D. Ruppe wrote: On Thursday, 18 May 2017 at 08:40:39 UTC, Andre Pany wrote: [...] Nope, case 2 is assigning to an already constructed object and case 3 is constructing a new one. [...] Thanks for the explanation, that makes perfectly sense.

Re: How to check a struct exists at a particular memory address?

2017-05-18 Thread Igor via Digitalmars-d-learn
On Thursday, 18 May 2017 at 20:20:47 UTC, Gary Willoughby wrote: This might be a really silly question but: I've allocated some memory like this (Foo is a struct): this._data = cast(Foo*) calloc(n, Foo.sizeof); How can I then later check that there is a valid Foo at `this._data` or