On Saturday, 9 February 2019 at 02:12:29 UTC, Murilo wrote:
Why is it that in C when I attribute the number
991234307654329925.7865 to a double it prints
991234299470108672. and in D it prints
9912342990. ? Apparently both languages
cause a certain loss
On Sunday, 17 December 2017 at 17:15:57 UTC, ParticlePeter wrote:
On Sunday, 17 December 2017 at 16:40:46 UTC, John wrote:
Yah the sc.ini file is wrong for Environment64.
[Environment64]
LIB="%@P%\..\lib64"
.
.
.
; Windows installer uncomments the version detected
LINKCMD=%VCINSTALLDIR%\bin\
On Sunday, 17 December 2017 at 15:57:08 UTC, ParticlePeter wrote:
I upgraded from DMD 2.074.1 (!) to 2.077.1 and tried to compile
a mixed c++/d project (DMD links to one c++ lib). Here is the
full error message:
fatal error C1905: Front end and back end not compatible (must
target same proces
On Friday, 29 July 2016 at 06:32:24 UTC, Fabian wrote:
I'm trying to add support for unicode to my app in D and having
issues.
string str = "Pokémon No";
writeln(str);
this outputs:
Pok├®mon No
what I want to do is change the funky character such that the
string reads:
Pok\u00e9mon No
as
On Tuesday, 19 July 2016 at 09:34:11 UTC, celavek wrote:
Hi,
I am trying to count characters in a string like:
const string dna_chain =
"AGCCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAGAGTGTCTGATAGCAGC";
counts['A'] = countchars!(dna_chain, 'A');
countchars(dna_chain, "A");
On Tuesday, 19 July 2016 at 01:22:01 UTC, jmh530 wrote:
import std.typecons : isTuple, tuple;
import std.stdio : writeln;
auto foo(T...)(T x)
{
T[0] y;
foreach (i, e; x)
{
y += e;
}
return y;
}
auto bar(T)(T x)
{
static if (isTuple
On Monday, 18 July 2016 at 18:49:22 UTC, Rufus Smith wrote:
Suppose I have the following: alias func = void function(int);
Is there a way to convert it automatically to something the
same type except of delegate: alias del = toDel(func) = void
delegate(int);?
import std.traits;
alias del = R
On Wednesday, 13 July 2016 at 20:28:40 UTC, Adam Sansier wrote:
On Wednesday, 13 July 2016 at 19:22:44 UTC, Kagamin wrote:
On Wednesday, 13 July 2016 at 16:48:53 UTC, Adam Sansier wrote:
There's a lot of misinformation on the net.
Nope, it's just you. COM support in D and in general works
fi
On Wednesday, 13 July 2016 at 07:31:57 UTC, Adam Sansier wrote:
void** ptr = null;
auto res = CoCreateInstance(&CLS_ID, cast(IUnknown)null,
CLSCTX_INPROC_SERVER, &CLS_ID, cast(void**)&ptr);
How are you casting your "ptr" variable (which BTW should be just
void* or usually IUnkno
On Tuesday, 12 July 2016 at 14:51:43 UTC, Adam Sansier wrote:
On Tuesday, 12 July 2016 at 14:27:49 UTC, Adam D. Ruppe wrote:
On Tuesday, 12 July 2016 at 05:16:30 UTC, Adam Sansier wrote:
Is there a way to do this?
write a new function that prints them and call that
This doesn't work to disp
On Tuesday, 5 July 2016 at 18:16:31 UTC, Charles Hixson wrote:
I've been reading std.datetime documentation backwards and
forwards, but if the information is there, I've been missing it.
How do I get the current time as a long?
Clock.currTime() returns a SysTime, and while currently I can
con
On Wednesday, 29 June 2016 at 14:51:10 UTC, Thalamus wrote:
I was hoping there would be a code-only solution, and I'm glad
to see one is possible. It isn't quite working for me yet,
though. I can get the HINSTANCE in the CoLoadLibrary call, but
GetProcAddress for DllGetClassObject fails, with
On Wednesday, 29 June 2016 at 17:55:27 UTC, John wrote:
On Wednesday, 29 June 2016 at 14:51:10 UTC, Thalamus wrote:
and the D code (mostly unchanged from your example):
interface ITestInterface
{
int Identifier();
}
ITestInterface needs to derive from IUnknown.
I realise that doesn't a
On Wednesday, 29 June 2016 at 14:51:10 UTC, Thalamus wrote:
and the D code (mostly unchanged from your example):
interface ITestInterface
{
int Identifier();
}
ITestInterface needs to derive from IUnknown.
On Monday, 27 June 2016 at 21:17:52 UTC, Thalamus wrote:
Hi everyone,
I've succeeded in using D as a client for regular (registered)
COM servers in the past, but in this case, I'm building the
server as well. I would like to avoid registering it if
possible so XCOPY-like deployment remains an
On Monday, 27 June 2016 at 17:14:23 UTC, John wrote:
On Monday, 27 June 2016 at 16:40:09 UTC, Nordlöw wrote:
If I have a template parameter
E = S!int
where
struct S(T) { S x; }
how can I extract the template name part `S` from E`?
Something like:
static assert(is(templateName!(
On Monday, 27 June 2016 at 16:40:09 UTC, Nordlöw wrote:
If I have a template parameter
E = S!int
where
struct S(T) { S x; }
how can I extract the template name part `S` from E`?
Something like:
static assert(is(templateName!(S!int) == S));
Is this already in Phobos somewhere?
On Saturday, 25 June 2016 at 12:35:39 UTC, Lodovico Giaretta
wrote:
On Saturday, 25 June 2016 at 12:30:22 UTC, Lodovico Giaretta
wrote:
If you want this to work, you need your lambdas to take the
casted value as a parameter:
Thanks.
On Saturday, 25 June 2016 at 13:44:48 UTC, Andre Pany wrote:
Hi everyone,
I have some issue with win32 function SetWindowsHookEx. For
this specific funtion there is no possibility to pass extra
data (pointer to a class instance to be called) to the callback
function.
The general solution se
On Saturday, 25 June 2016 at 09:12:12 UTC, Lodovico Giaretta
wrote:
On Saturday, 25 June 2016 at 09:07:19 UTC, Lodovico Giaretta
wrote:
Instead of passing functions to match!, pass pairs of
arguments, like this:
match!(T,
int, writeln("Matched int"),
is(T : SomeObject), w
Writing a long series of "static if ... else" statements can be
tedious and I'm prone to leaving out the crucial "static" after
"else", so I was wondered if it was possible to write a template
that would resemble the switch statement, but for types.
Closest I came up to was this:
void match
On Wednesday, 15 June 2016 at 21:06:01 UTC, Joerg Joergonson
wrote:
My thinking is that CoCreateinstance is suppose to give us a
pointer to the interface so we can use it, if all this stuff is
crashing does that mean the interface is invalid or not being
assigned properly or is there far more t
On Wednesday, 15 June 2016 at 18:35:42 UTC, Joerg Joergonson
wrote:
On Wednesday, 15 June 2016 at 06:09:33 UTC, thedeemon wrote:
On Monday, 13 June 2016 at 17:38:41 UTC, Incognito wrote:
[...]
There are ready tools idl2d:
https://github.com/dlang/visuald/tree/master/c2d
[...]
I can't seem
On Wednesday, 15 June 2016 at 18:32:28 UTC, Joerg Joergonson
wrote:
import core.sys.windows.com, core.sys.windows.oaidl;
Thanks. Should these not be added to the generated file?
The problem is that other type libraries will probably require
other headers to be imported, and there's no way
On Wednesday, 15 June 2016 at 16:45:39 UTC, Joerg Joergonson
wrote:
Thanks. When I ran it I got a d file! when I tried to use that
d file I get undefined IID and IDispatch. I imagine these
interfaces come from somewhere, probably built in?
Any ideas?
Add the following after the module name:
On Wednesday, 15 June 2016 at 08:21:06 UTC, John wrote:
OK, adding the return type to the signature should fix that. So:
private static Parameter getParameters(MethodImpl method)
Sorry, I meant the getParameter methods should return be:
private static Parameter[] getParameters(MethodImpl
On Wednesday, 15 June 2016 at 06:56:59 UTC, Joerg Joergonson
wrote:
When I try to compile your code I get the following errors:
main.d(953): Error: function
core.sys.windows.objbase.CoTaskMemAlloc (uint) is not callable
using argument types (immutable(ulong))
main.d(970): Error: can only slic
On Monday, 13 June 2016 at 19:26:08 UTC, Incognito wrote:
On Monday, 13 June 2016 at 19:11:59 UTC, John wrote:
On Monday, 13 June 2016 at 17:38:41 UTC, Incognito wrote:
Cool. Oleview gives me the idl files. How to convert the idl
files to d or possibly c?
Would I just use them in place of IUn
On Monday, 13 June 2016 at 17:38:41 UTC, Incognito wrote:
Cool. Oleview gives me the idl files. How to convert the idl
files to d or possibly c?
Would I just use them in place of IUnknown once I have the
interface?
In OleView you can save the IDL file, then run another tool,
midl.exe, on th
On Monday, 13 June 2016 at 01:22:33 UTC, Incognito wrote:
I've been reading over D's com and can't find anything useful.
It seems there are different ways:
http://www.lunesu.com/uploads/ModernCOMProgramminginD.pdf
which is of no help and requires an idl file, which I don't
have.
Then theres
On Monday, 6 June 2016 at 15:23:50 UTC, chmike wrote:
Hello,
I have a structure with two fields ad defined as
struct Info {
this(int value, Category category)
{
category_ = category;
value_ = category ? value : 0;
}
// This converts implicitly to bool.
Additionally, remove QueryInterface, AddRef and Release from the
definition of IDirectSound. Also, interfaces are already
references, so the definition of LPDIRECTSOUND should be:
alias LPDIRECTSOUND = IDirectSound;
Note there should be no *.
Regarding any linking errors, it's easier to eit
If I define a template in one module, and specialize it in a
second module, the compiler doesn't like it when I try to call a
function using the template.
module one;
struct Test(T) {}
void testing(T)(Test!T t) {}
module two;
struct Test(T : int) {}
void main() {
Test!int i
On Wednesday, 9 March 2016 at 20:30:44 UTC, Guillaume Piolat
wrote:
On Tuesday, 8 March 2016 at 18:11:24 UTC, John wrote:
You can go with Algebraic. I used to do that in scheme-d. Then
I switched to a tagged union by hand to avoid a compiler
regression. Algebraic was OK.
2x speed differe
Hi,
I'm currently reading "Programming in D" and in order to get
accustomed to D and it's syntax, I've decided to implement
(actually port) a simple (and naive) Scheme interpreter from C to
D. The original interpreter (in C) is described in a series of
posts here:
http://peter.michaux.ca/ar
On Sunday, 6 March 2016 at 03:13:23 UTC, 岩倉 澪 wrote:
IShellLinkA* shellLink;
IPersistFile* linkFile;
Any help would be highly appreciated as I'm new to Windows
programming in D and have no idea what I'm doing wrong!
In D, interfaces are references, so it should be:
IShellLinkA shel
On Friday, 1 January 2016 at 10:14:58 UTC, Shriramana Sharma
wrote:
Hello. I'm trying the following code:
import std.stdio;
class TimeSpan
{
immutable double start, end;
@property double length() { return end - start; }
}
void main()
{
auto p = TimeSpan(1, 2);
writeln(p.length);
On Sunday, 12 July 2015 at 04:30:58 UTC, John wrote:
Is there a way I can call D code from assembly without
declaring functions as extern(C) and and doing it the C way?
SOLVED:
Found the calling convention description.
http://dlang.org/abi.html
Is there a way I can call D code from assembly without declaring
functions as extern(C) and and doing it the C way?
On Thursday, 21 May 2015 at 16:25:24 UTC, Adam D. Ruppe wrote:
Start with a function type declaration:
void function() func_ptr;
Then make an array out of it:
void function()[] func_ptr_array;
It works like other arrays, just the [] might be a little
harder to see since it is a much longer
I've been rewriting one of my emulators in D and am fairly new to
the language. I'm having trouble finding documentation on
creating/initializing/use of arrays of function pointers in D. If
anyone has a code example I'd appreciate it!
On Monday, 27 October 2014 at 23:19:42 UTC, anonymous wrote:
On Monday, 27 October 2014 at 22:43:23 UTC, John wrote:
The C++ code:
// Bitfield utilities
template
struct RegBit
{
[...]
template
RegBit& operator=(T2 val)
[...]
};
My D implementation thus far:
[...]
template RegBit(ui
Howdy,
I stumbled across a tiny NES emulator written in C++
(http://bisqwit.iki.fi/jutut/kuvat/programming_examples/nesemu1/nesemu1.cc)
that I feel compelled to make even tinier with some D magic. I am
having trouble with a nested template in the code.
The C++ code:
// Bitfield utilities
te
Hi.
Now I try to use SSE/AVX instructions in D inline asm.
I have a trouble about this.
In http://dlang.org/iasm.html ,
AVX seems to be supported according to SIMD section in the paeg.
But there is no AVX opcodes, like vaddps, in Opcodes section in
the page.
So I have assumed addps can be used
On Friday, 6 June 2014 at 22:27:38 UTC, bearophile wrote:
John:
I can iterate over the struct elements with the traits
FieldTypeTuple!foo,
In such iteration you are using a static foreach. Types are
compile-time constructs in D. If you need run-time entities you
need to get their typeinfo.
So let's say I'm trying to create a really simple ORM. I have a
struct:
struct foo {
int a;
float b;
}
I can iterate over the struct elements with the traits
FieldTypeTuple!foo, I can iterate over the the string that
represents the elements I want to shove in the struct, but w
46 matches
Mail list logo