How Use/Load/Recovery Files in resource.res files?

2019-12-08 Thread Marcone via Digitalmars-d-learn
I have added files inside resource.res. The icon.ico is automated 
used for exe program icon. But I don't know how use others files 
inside resource res. How Use/Load/Recovery Files in resource.res 
files?


Re: How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

2019-12-08 Thread Marcone via Digitalmars-d-learn

On Sunday, 8 December 2019 at 20:56:05 UTC, mipri wrote:

On Sunday, 8 December 2019 at 20:50:05 UTC, Marcone wrote:

I want to add version to my program.
I have configurated my version file "version.txt",  but I dont 
know how link this file to my program. If Need spec file, 
please send the exemple code of spec. Or is is possible add 
version file by dmd command line or resources. Thank you.


I'm not sure I know what you're asking, but maybe this is
the answer.

In version.txt:

  0.1.0 - a version example

In version.d:

  import std.string : chomp;

  immutable Version = import("version.txt").chomp;

  void main() {
  import std.stdio : writeln;
  writeln("Version: ", Version);
  }

To compile and run with both files in the current directory:

  dmd -J. -run version

With output:

  Version: 0.1.0 - a version example

The corresponding dub setting is probably stringImportPaths


How can I add this "version.txt":

VSVersionInfo(
ffi=FixedFileInfo(
filevers=(1,0,0,0), # Version Number.
prodvers=(1,0,0,0), # Version Number.
mask=0x3f,
flags=0x0,
OS=0x40004,
fileType=0x1,
subtype=0x0,
date=(0, 0)
),
kids=[
StringFileInfo(
[
StringTable(
'040904b0',
[
#StringStruct('Comments', ''), # Description 
Information.
#StringStruct('CompanyName', ''), # Description 
Information.
StringStruct('FileDescription', 'Programa'), # 
Description Information.
StringStruct('FileVersion', ' 1,0,0'), # Version 
Number.
#StringStruct('InternalName', ''), # Description 
Information.
StringStruct('LegalCopyright', 'Copyright 2019 
Marcone'), # Description Information.
#StringStruct('LegalTrademarks', ''), # Description 
Information.
#StringStruct('OriginalFilename', ''), # Description 
Information.
StringStruct('ProductName', 'Programa'), # 
Description Information.
StringStruct('ProductVersion', ' 1,0,0'), # Version 
Number.

]
)
]
),
VarFileInfo(
[
VarStruct('Translation', [1033, 1200])
]
)
]
)


Re: How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

2019-12-08 Thread GoaLitiuM via Digitalmars-d-learn

On Sunday, 8 December 2019 at 20:50:05 UTC, Marcone wrote:

I want to add version to my program.
I have configurated my version file "version.txt",  but I dont 
know how link this file to my program. If Need spec file, 
please send the exemple code of spec. Or is is possible add 
version file by dmd command line or resources. Thank you.


If you have a compiled Windows resource file (resources.res), you 
can pass it to DMD like any source file (dmd foo.d bar.d 
resources.res...).


Re: How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

2019-12-08 Thread mipri via Digitalmars-d-learn

On Sunday, 8 December 2019 at 20:50:05 UTC, Marcone wrote:

I want to add version to my program.
I have configurated my version file "version.txt",  but I dont 
know how link this file to my program. If Need spec file, 
please send the exemple code of spec. Or is is possible add 
version file by dmd command line or resources. Thank you.


I'm not sure I know what you're asking, but maybe this is
the answer.

In version.txt:

  0.1.0 - a version example

In version.d:

  import std.string : chomp;

  immutable Version = import("version.txt").chomp;

  void main() {
  import std.stdio : writeln;
  writeln("Version: ", Version);
  }

To compile and run with both files in the current directory:

  dmd -J. -run version

With output:

  Version: 0.1.0 - a version example

The corresponding dub setting is probably stringImportPaths


How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

2019-12-08 Thread Marcone via Digitalmars-d-learn

I want to add version to my program.
I have configurated my version file "version.txt",  but I dont 
know how link this file to my program. If Need spec file, please 
send the exemple code of spec. Or is is possible add version file 
by dmd command line or resources. Thank you.


Re: needing to change the order of things at module level = compiler bug, right?

2019-12-08 Thread DanielG via Digitalmars-d-learn
On Sunday, 8 December 2019 at 18:01:03 UTC, Steven Schveighoffer 
wrote:
Yes, if it can compile when you move things around, and the 
result is *correct* (very important characteristic)


Indeed, everything's working as intended when rearranged.

Thanks!



Re: needing to change the order of things at module level = compiler bug, right?

2019-12-08 Thread Steven Schveighoffer via Digitalmars-d-learn

On 12/8/19 11:43 AM, DanielG wrote:
I dustmite'd down my problem code, and it seems just changing the order 
of declarations makes the error go away. Specifically, moving a class 
declaration from the bottom of the file, to the top, allows it to 
compile. I also commented on two other things that can be changed to 
make it work - neither seemingly related to the error at hand.


Yes, if it can compile when you move things around, and the result is 
*correct* (very important characteristic), then it's definitely a bug. 
There should be no ordering requirements for module-level code.


-Steve


Re: GC.collect inflating memory usage?

2019-12-08 Thread Rainer Schuetze via Digitalmars-d-learn


On 07/12/2019 21:05, Rainer Schuetze wrote:
> 
> On 07/12/2019 12:20, cc wrote:
>> Given the following program:
> [...]
>>
>> Using DMD32 D Compiler v2.089.0-dirty
>>
> 
> Seems like a bug introduced in dmd 2.086, I've created a bugzilla issue:
> https://issues.dlang.org/show_bug.cgi?id=20438
> 
> I suspect there is something broken with respect to the free-lists
> inside the GC when manually freeing memory :-/
> 

Fixed in stable for the next point-release.


needing to change the order of things at module level = compiler bug, right?

2019-12-08 Thread DanielG via Digitalmars-d-learn
I dustmite'd down my problem code, and it seems just changing the 
order of declarations makes the error go away. Specifically, 
moving a class declaration from the bottom of the file, to the 
top, allows it to compile. I also commented on two other things 
that can be changed to make it work - neither seemingly related 
to the error at hand.


Just double-checking before I file a bug for this:
--
import sumtype;

// DMD 2.089.0-dirty (also v2.087.1)
// app.d(18,13): Error: struct 
sumtype.SumType!(CallbackType1).SumType is not copyable because 
it is annotated with @disable


struct Struct1(T) {
bool[T] items;
}

struct CallbackType1 {
void delegate(Struct1!Class2) func;   // changing arg to 
Class2[] compiles OK

}
alias CallbackType = SumType!CallbackType1;

class Class1 {
CallbackType _callback;
this(CallbackType callback) { // commenting out this ctor 
compiles OK

_callback = callback;
}
}

// moving Class2 to the top of the file compiles OK
class Class2 {
Struct1!Class1 subscribers;
}

void main() {}


Re: Are there any DUB packages for displaying an ascii table?

2019-12-08 Thread Soulsbane via Digitalmars-d-learn

On Sunday, 8 December 2019 at 08:12:49 UTC, mipri wrote:

On Sunday, 8 December 2019 at 08:01:32 UTC, Soulsbane wrote:
Been playing with Golang lately and it has quite a few modules 
for terminal tables. For example this one: 
github.com/brettski/go-termtables.


Is there a D equivalent package? Can't seem to find any via 
search(which by the ways seems to give bad results or I just 
can't find the right word to search with).


Thanks!


This exists and was updated as recently as the first of 
December:


https://code.dlang.org/packages/asciitable

I don't see any other dub packages that look related.


Thanks! I'll try it. The search seems to be really strict. Didn't 
show up when I searched 'table'. LOL doesn't show up with 'ascii' 
either. Put them together and it finds it.


Thanks again though, I appreciate it!


Re: Are there any DUB packages for displaying an ascii table?

2019-12-08 Thread mipri via Digitalmars-d-learn

On Sunday, 8 December 2019 at 08:01:32 UTC, Soulsbane wrote:
Been playing with Golang lately and it has quite a few modules 
for terminal tables. For example this one: 
github.com/brettski/go-termtables.


Is there a D equivalent package? Can't seem to find any via 
search(which by the ways seems to give bad results or I just 
can't find the right word to search with).


Thanks!


This exists and was updated as recently as the first of December:

https://code.dlang.org/packages/asciitable

I don't see any other dub packages that look related.


Are there any DUB packages for displaying an ascii table?

2019-12-08 Thread Soulsbane via Digitalmars-d-learn
Been playing with Golang lately and it has quite a few modules 
for terminal tables. For example this one: 
github.com/brettski/go-termtables.


Is there a D equivalent package? Can't seem to find any via 
search(which by the ways seems to give bad results or I just 
can't find the right word to search with).


Thanks!