imho, regexp is overkill here.
as for me, i usually just split line for first '=', then trim
spaces left and right parts.
leyts try very rough simlified concept:
template itself - is compile-time program (parameterizable), it
can generate some code for you.
template instantiation (like "calling") with "!" - instruct
compiler to "start this compile-time program here with this
parameters".
On Tuesday, 8 November 2022 at 12:30:50 UTC, Alexander Zhirov
wrote:
A c;
this declaration not creates class instance. you should use "new".
btw, struct have other behavoiur
to avoid special compile command just add one code line:
pragma(lib, "user32.lib");
On Friday, 30 December 2022 at 04:43:48 UTC, Salih Dincer wrote:
...
// example one:
char[] str1 = "cur:€_".dup;
...
// example two:
dchar[] str2 = cast(dchar[])"cur:€_"d;
...
SDB@79
why you use .dup it example one, but not use in example two?
dchar[] str2 = cast(dchar[])"cur:€_"
try to rename function to distinguish from source module
It there any recipe to compile x64 .dll without dependencies?
I mean it shoud be used without installing things like
msvcr120.dll.
Dependencies on system dll (advapi32.dll, kerner32.dll) is ok.
I don't experiment on linux yet. But interest too.
On Sunday, 5 March 2023 at 18:35:58 UTC, Guillaume Piolat wrote:
"targetType": "dynamicLibrary",
"dflags-linux-dmd": ["-defaultlib=libphobos2.a"],
"dflags-osx-ldc": ["-static"],
"dflags-linux-ldc": ["-link-defaultlib-shared=false"],
"dflags-linux-x86_64-ldc": ["-fvisibility=hi
On Monday, 27 March 2023 at 17:56:22 UTC, Alexander Zhirov wrote:
I get `objectGUID` data from LDAP as binary data. I need to
convert `ubyte[]` data into a readable `UUID`. As far as I
understand, it is possible to do this via `toHexString()`, but
I have reached a dead end. Is there a way to ma
you cannot "static link dll", "d" in "dll" is "dynamic".
you can implicity or explicity load dll.
https://learn.microsoft.com/en-us/cpp/build/linking-an-executable-to-a-dll?view=msvc-170
may be you mean static link msvcr120.lib?
i am not windows guru, but you need msvcr120.lib (there is 2
versi
On Thursday, 1 June 2023 at 15:05:40 UTC, Marcone wrote:
I linked msvcr120.lib, but the executable still ask for
msvcr120.dll not found.
i am sorry.
my words was sourced from common sence, usual practice.
it seems, msvcr120 is special case, and have only one version of
.lib - for link to .dll
On Thursday, 8 June 2023 at 05:29:07 UTC, Benny wrote:
Hello,
Hi!
I'm trying to call the function GetInterfaceInfo
it would be nice to see the code
didn't work.
it would be nice to see specifics (error code, results, etc)
```
import std;
auto arr = [dchar(' '), '\t', 0x0a, 0x10];
void main()
{
writeln("Hello D: ", typeid(arr));
}
```
On Sunday, 3 September 2023 at 13:55:45 UTC, Vino wrote:
f.open(fn, "rb");
here you command to your pc: "now open fn and treat is as binary
file"
on windpows you can hide (move .obj away from sources dir) by add
to compile command
-od="%TEMP%\dmd\myproject"
may be std.string.representation() may help?
https://dlang.org/phobos/std_string.html#.representation
byteSize = representation(myString).length;
On Monday, 18 December 2023 at 03:39:16 UTC, Ki Rill wrote:
On Sunday, 17 December 2023 at 07:05:12 UTC, Adam D. Ruppe
wrote:
On Sunday, 17 December 2023 at 04:13:20 UTC, Ki Rill wrote:
[...]
check what `op` is. pretty sure it is "+" not "+=" so your
element isnt' saved anywhere. also a bit
On Monday, 18 March 2024 at 08:50:42 UTC, rkompass wrote:
Given the types S and T in say `templfunc(S, T)(S arg1, T arg2)
{}`
represent 2 different actual types in the program, does that
mean that there are 4 versions of the `templfunc` function
compiled in? (This was the C++ way iirc).
IMHO,
On Monday, 18 March 2024 at 10:05:43 UTC, novice2 wrote:
On Monday, 18 March 2024 at 08:50:42 UTC, rkompass wrote:
Or are the types T and S are put on the stack like ordinary
arguments and the usage of arg1 and arg2 within the function
is enveloped in switches that query these Types?
IMHO, on
On Wednesday, 5 February 2020 at 20:01:19 UTC, Marcone wrote:
Sorry! Solved. Just need add # in this line:
get_resource("#300", "BMP", "melancia.bmp");
the mistake, very imho, is not check windows API functions
results.
you can use wenforce:
https://dlang.org/phobos/std_windows_syserror.html
import std.conv: to;
string str = "test1";
wstring[] wstr = [to!wstring(str)];
On Friday, 17 April 2020 at 21:38:23 UTC, Quantium wrote:
Are there any libs which can be used to access cmd commands?
std.process
https://dlang.org/phobos/std_process.html#.execute
"doesn't work" isn't very helpful. Are you seeing compiler
errors? Linker errors? Runtime errors? Please describe your
problem.
Solved my problem alone : wrong signatures with functions ;)
and this reply isn't very helpful.
what is right signature?
you go to forum to ask help.
but wish you he
Dear Marcone, that you want we all to do?
Rar detect sfx by small signature, and some bytes in exe looks
like signature.
But this is not the problem - just do not open your exe with rar.
Or i just don't understand...
Another options:
1. try to compile with anoter .res or/and another .ico (if m
5. Open WinRAR support issue
6. Upload your .exe and say WinRar version then other peoples can
reproduce
On Tuesday, 30 March 2021 at 13:43:52 UTC, Mike Parker wrote:
the straightforward way is just to use an alias.
i cant use alias - compiler cannot distinguish base type and
alias, and cannot catch programmer errors
Buf if you need a more concrete type, you can use alias this in
a struct:
I
On Tuesday, 30 March 2021 at 14:45:12 UTC, WebFreak001 wrote:
Xobj can then be used interchangeably with void*, so all void*
arguments accept Xobj and all Xobj arguments accept void*.
yes, i understand alias, and i dont want such behaviour
If you want a type-safe alias that makes all void* ar
On Tuesday, 30 March 2021 at 19:12:29 UTC, Ali Çehreli wrote:
"Derived type" is used in the context of object oriented
programming at least in D
Sorry, i use wrong termin.
I just want create new type Tnew, based on exist type Tbase.
Tnew have same allowed values, same properties, same allowed
My tries to make template for struct and alias this:
// variant 1
template Typedef(alias Tnew, Tbase)
{
struct Tnew
{
Tbase payload;
alias payload this;
}
}
Typedef!(Xobj, void*);
void foo (Xobj obj) {} //compiler Error: no identifier for
declarator Typedef!(Xobj, void*)
thanks, i tried 2 variants:
```d
struct Tnew {TBase payload; alias payload this;}
```
```d
enum Tnew : Tbase {init = Tbase.init}
```
both works, but 1-st not allow "2 level" cast:
```d
struct Xptr {void* payload; alias payload this;} //Xptr based on
void*
struct Xobj {Xptr payload; alias payload
On Wednesday, 7 April 2021 at 13:43:18 UTC, Paul Backus wrote:
So, you should change your code to
writefln("%-(%s, %)", s);
sorry i dont read docs so carefully
thanks
Hello.
I need use std.format.format() in nothrow function.
format() can throw.
For this case i have special default string.
I don't want embrace format into try..catch block,
and i found elegant std.exception.ifThrown.
But DMD say "ifThrown not nothrow"
https://run.dlang.io/is/kXtt5q
```d
nothrow
Thank you Imperatron, Ali
both variants
```d
scope(failure) assert(0);
```
```d
collectException
```
works!
Thank Meta
The reason for this, apparently, is in the definition of
`ifThrown`
i tried to modify ifThrown adding nothrow,
but compiler dont understand, that second parameter cant thr
btw for my immediate needs i replace second delegate with value
i.e. remove "lazy" from declaration and remove "()" in return
so ifThrown loose some generity
```d
nothrow
CommonType!(T1, T2) ifThrown(E : Throwable = Exception, T1, T2)
(lazy scope T1 expression, scope
Hello.
Can please anybody help me create template format2 like
std.format.format,
so it can access to format string (change it for example)
then instantiate std.format.format template in
compile-time-checkable way
format!"%d %s"(arg1, arg2)
so compiler can check format string vs arguments cou
On Saturday, 1 May 2021 at 16:21:33 UTC, Anonymouse wrote:
https://run.dlang.io/is/QsYCkq
http://ddili.org/ders/d.en/templates.html).
thanks for your time!
format!"fmt"() and writef!"fmt"() templates
with compile-time checked format string
not accept %X for pointers,
but format() and writef() accept it
https://run.dlang.io/is/aQ05Ux
```
void main() {
import std.stdio: writefln;
int x;
writefln("%X", &x); //ok
writefln!"%s"(&x); //
On Monday, 9 August 2021 at 19:53:48 UTC, Marcone wrote:
program not run.
compilation errors?
runtime errors?
Thanks Kagamin!
One more way, i think,
mark function with UDA,
and then analize UDA in template.
But i have problem to implement this:
i have function name __FUNCTION__ in template as sting,
but __traits(getAttributes, __FUNCTION__) want symbol,
not string as second parameter :(
On Tuesday, 26 October 2021 at 09:44:42 UTC, Kagamin wrote:
`debug(func1)writefln(...)`
But specify a global debug version for the compiler:
`dmd -debug=func1 app.d`
i want to eliminate "debug(func1)"
i want to be able on/off debugging for one function or another,
and logf() template should "un
On Tuesday, 26 October 2021 at 15:53:54 UTC, Steven Schveighoffer
wrote:
mixin("debug(" ~ func ~ ") doRealThing();");
Thank you, Steven.
Unfortunately, all variants with global "-debug" in command line
is unhandy.
It leads to ugly, very big command line :(
Note that setting debug versions d
On Wednesday, 27 October 2021 at 08:14:29 UTC, Kagamin wrote:
...
Then the logger can inspect symbols in the template argument
and compare their names to the function name.
Aha, thank you, i will try!
On Thursday, 10 February 2022 at 12:08:07 UTC, tastyminerals
wrote:
I meant a different thing though. I am looking for
`mydic.update(another_dic)` analogue where `{"a": 1, "b": 2}`
update `{"c": 3, "a": -1}` becomes `{"a":-1, "b": 2, "c": 3}`.
you need "merge"?
https://forum.dlang.org/post/fhh
what buffer you are talking.
internal buffer. where result line resides.
And what is "signal"? How it's working?
just the fact for programmer, that result line can be changed by
other code (by phobos library code in this case).
no any special programming "signal".
On Monday, 19 October 2015 at 15:56:00 UTC, Namal wrote:
Is it possible to use foreach backwards?
yes
http://dlang.org/statement.html#ForeachStatement
http://dpaste.dzfl.pl/cf847a9e1595
I have 2 reduced files, wich i can't compile with new (DMD 2.066)
rdmd.exe under Windows 7 32-bit.
Command: rdmd --force --build-only aaa.d
Message "Error 42: Symbol Undefined _D3etc3bbb3fooFZi"
But command: dmd aaa.d etc\bbb.d
Compile without errors.
And then i replace rdmd.exe by old (from DM
On Saturday, 23 August 2014 at 17:32:15 UTC, Vladimir Panteleev
wrote:
"etc" is a standard D package name reserved for Phobos, the
Thanks for explanation.
I not be able to undertsand the cause - weird error message.
Now i can easy fix my code.
BTW, did rdmd determine user code or standard libr
Hello.
I need write some wrapper around legacy data structure.
May be it should be class. May be structure with methods.
The problem is writing repetitive code for underlying data.
For example:
- code to read length-byte-prefixed string to D string for every
field in every structure;
- code t
On Monday, 3 November 2014 at 14:53:29 UTC, Ali Çehreli wrote:
It sounds possible but I don't understand it yet. Can you give
an example of the input and output to the D code?
Ali
Thank you Ali.
I realized, that my wishes look like serialization.
So i decide read and learn code from existent
I want to use external or C function.
It used only one time from one D function.
I want do declare C function inside D function.
I don't want to declare C function in global scope.
Is my wish correct?
Reduced code:
extern (C) int getch();
void main() {
getch();
}
//compiled OK
void main()
Thanx Daniel, thanx Ketmar.
I just thinked that this is some sort of bug.
May be DMD should not change mangled name of external function...
Bit i dont know.
what if a_college[i] will contain ` char?
almost SQL have "prepare" statement...
sorry - i cant find where i can post this.
bugtracker have no dlang.org product.
when i click to left menu "Standart Library - std - windows -
charset"
then i have error "The requested URL
/phobos/std_windows_charset.html was not found on this server."
Could you, please, help me to understand, why code:
import std.c.windows.windows;
import std.exception: ErrnoException;
import std.stdio: writefln;
import std.string: toStringz;
void main ()
{
CreateFileA(toStringz("nonexisting file name"), GENERIC_READ,
FILE_SHARE_READ, null
Thans guys!
wenforce not sutable - error code is lost.
may be, i will use modified wenforce, wich throws ErrnoException.
Ha, i found
std.windows.syserror: WindowsException, wenforce;
Hello.
Help me please to understand, how to show usage help to user, who
enter wrong options?
For example, user not provided required filename.
I want to show error message, and program usage help text.
But likely getopt don't provide help text until valid options
will be parsed.
Reduced cod
Thank you, Brian!
I cannot get the longest possible
it match longest for first group ([a-z]+)
try
^([a-z]+?)(hula|ula)$
http://forum.dlang.org/thread/hrzfcjrltftgzansd...@forum.dlang.org
https://github.com/Trass3r/hooksample
60 matches
Mail list logo