#!/usr/bin/env rdmd
import core.stdc.stdio;
template G(size_t line = __LINE__, A...){
int i = 3;
static extern(C) pragma(crt_constructor) void init2(){
printf("init: %d\n", line);
}
}
pragma(crt_constructor) extern(C) void init1(){
printf("init fro
On Wednesday, 8 August 2018 at 21:54:34 UTC, aliak wrote:
I'm trying to debug stuff, so I want to add verbose logging
struct S(T) {
this() {
writeln("created S(T) with properties and ID");
}
}
static a = S!int(); // bah
I guess users can call this code from any context, but when i'd
a
On Thursday, 9 August 2018 at 21:59:24 UTC, Johannes Loher wrote:
I already posted this in the vibe.d forums
(https://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/58891/), but it seems, there is not a lot of activity over there, so I am cross posting this here:
[...]
Do you
import core.stdc.stdio;
struct Test {
string name ;
}
void T(alias pred, A...)(){
__gshared t = Test(A) ;
pred(t);
}
extern(C) void main(){
T!(t => printf("test 1 name = %s\n".ptr, t.name.ptr), "test") ;
// build OK
T!(t => {
printf("test 2
On 10/08/2018 9:57 PM, learnfirst1 wrote:
import core.stdc.stdio;
struct Test {
string name ;
}
void T(alias pred, A...)(){
__gshared t = Test(A) ;
pred(t);
}
extern(C) void main(){
T!(t => printf("test 1 name = %s\n".ptr, t.name.ptr), "test") ; //
build OK
T!(t =>
On Friday, 10 August 2018 at 09:57:53 UTC, learnfirst1 wrote:
import core.stdc.stdio;
struct Test {
string name ;
}
void T(alias pred, A...)(){
__gshared t = Test(A) ;
pred(t);
}
extern(C) void main(){
T!(t => printf("test 1 name = %s\n".ptr, t.name.ptr), "test")
;
On Friday, 10 August 2018 at 08:31:21 UTC, learnfirst1 wrote:
#!/usr/bin/env rdmd
import core.stdc.stdio;
template G(size_t line = __LINE__, A...){
int i = 3;
static extern(C) pragma(crt_constructor) void init2(){
printf("init: %d\n", line);
}
}
pragma(c
On Friday, 10 August 2018 at 09:57:53 UTC, learnfirst1 wrote:
T!(t => {
printf("test 2 name = %s\n".ptr, t.name.ptr);
}, "test") ; // build error
This is not doing what you think it's doing. The syntax t => {
return t; } is equivalent to t => () => t. That is, i
On Friday, 10 August 2018 at 09:29:04 UTC, Timoses wrote:
On Wednesday, 8 August 2018 at 21:54:34 UTC, aliak wrote:
I'm trying to debug stuff, so I want to add verbose logging
struct S(T) {
this() {
writeln("created S(T) with properties and ID");
}
}
static a = S!int(); // bah
I guess
On Friday, 10 August 2018 at 10:38:53 UTC, Simen Kjærås wrote:
What you should do instead is:
T!((t){
printf("test 2 name = %s\n".ptr, t.name.ptr);
}, "test");
(note the lack of the => arrow)
--
Simen
rikki cattermole , Paul Backus, Simen Kjærås: thanks for the
exp
On Friday, 10 August 2018 at 10:24:55 UTC, Simen Kjærås wrote:
On Friday, 10 August 2018 at 08:31:21 UTC, learnfirst1 wrote:
The correct behavior would be for the compiler to show the
latter error message for a mixin'd function as well.
Filed a bug:
https://issues.dlang.org/show_bug.cgi?id=191
On Friday, 10 August 2018 at 10:24:55 UTC, Simen Kjærås wrote:
On Friday, 10 August 2018 at 08:31:21 UTC, learnfirst1 wrote:
Filed a bug:
https://issues.dlang.org/show_bug.cgi?id=19153
template G(){
pragma(crt_constructor) static extern(C) void init(){}
}
void main(){
mixin G!(); // Li
On Friday, 10 August 2018 at 11:10:55 UTC, learnfirst1 wrote:
Still, if my first example is use GC, why dmd not throw error
at compile time, instead at link time report symbols is
missing. Is this a bug ?
If you make your main function @nogc, you will get a compile-time
error.
On Friday, 10 August 2018 at 11:17:10 UTC, learnfirst1 wrote:
I think the static extern(C) nested function should just work
like global extern(C) function. DMD still report missing
symbols. Or I am wrong about this ?
template G(){
static extern(C) pragma(crt_constructor) void init(){}
Hi,
How should I set up DMD to be able to `dmd -m64` on Windows
nowadays?
I usually download the 7z, but it broke when I replaced my Visual
Studio with 2017 edition.
Now, I tried the current 2.081.1 .exe installer. It didn't
propose any additional 64-bit related options. After the
insta
On Friday, 10 August 2018 at 12:05:52 UTC, Simen Kjærås wrote:
On Friday, 10 August 2018 at 11:17:10 UTC, learnfirst1 wrote:
If you try the same without the mixin template, you'll see that
it doesn't work:
struct Test {
extern(C) pragma(crt_constructor) static void init(){ // work
mixin template test(A...){
__gshared a = A;
a++;
}
extern(C) void main(){
mixin test!123;
}
-
I dont want to use string mixin to intro a lot un want symbol,
try with mixin template find this not work.
I know if mixin test on global it should not working,
On Thursday, 2 August 2018 at 10:47:33 UTC, Ky-Anh Huynh wrote:
Hi,
can I build my program on OpenWrt? I haven't found any
resources on internet maybe I'm missing something.
Thanks a lot.
A status report on what works and how to get LDC to compile for
OpenWRT uClibc ARM:
https://github.co
On Friday, 10 August 2018 at 12:38:55 UTC, learnfirst1 wrote:
mixin template test(A...){
mixin template test(A...){
__gshared a = A;
}
extern(C) void main(){
mixin test!123;
}
---
duplicate symbol __D4test4mainUZ8__mixin111__a_field_0i in:
test.o
ld: 1 duplic
Mixim template can only introduce declarations, not statements, a
workaround is a lambda called in place.
mixin template test(A...){
__gshared a = A;
int dummy = (){ a++; return 0; }();
}
extern(C) void main(){
mixin test!123;
}
On Friday, 10 August 2018 at 13:01:21 UTC, learnfirst1 wrote:
duplicate symbol __D4test4mainUZ8__mixin111__a_field_0i in:
test.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to
see invocation)
Error: linker exited with status 1
On Friday, 10 August 2018 at 13:05:24 UTC, Kagamin wrote:
Mixim template can only introduce declarations, not statements,
a workaround is a lambda called in place.
mixin template test(A...){
__gshared a = A;
int dummy = (){ a++; return 0; }();
}
extern(C) void main(){
m
On Friday, 10 August 2018 at 13:05:24 UTC, Kagamin wrote:
Mixim template can only introduce declarations, not statements,
a workaround is a lambda called in place.
mixin template test(A...){
__gshared a = A;
int dummy = (){ a++; return 0; }();
}
extern(C) void main(){
m
On Friday, 10 August 2018 at 13:10:57 UTC, Kagamin wrote:
On Friday, 10 August 2018 at 13:01:21 UTC, learnfirst1 wrote:
Looks like some problem with tuple, try __gshared a = A[0];
this work, it report no error but give a link problem. (this
could be a bug ?)
On Friday, 10 August 2018 at 13:17:13 UTC, learnfirst1 wrote:
this work, it report no error but give a link problem. (this
could be a bug ?)
mixin template test(A...){
__gshared int a = A[0];
pragma(inline, true) // remove this will work
static extern(C) int test(){
try this:
mixin template test(A...){
__gshared int a = A[0];
int dummy = (){
a++;
return 0;
}();
}
import core.stdc.stdio;
int main(){
mixin test!1;
printf("a=%d\n", a);
return 0;
}
On Friday, 10 August 2018 at 12:15:55 UTC, Ivan Kazmenko wrote:
Hi,
How should I set up DMD to be able to `dmd -m64` on Windows
nowadays?
I usually download the 7z, but it broke when I replaced my
Visual Studio with 2017 edition.
If you were using another Visual Studio version, since VS 20
The dmd installer should normally deal with it, maybe it doesn't
support VS2017 yet or you didn't install VC++. Try to uninstall
dmd, delete its configuration files and install again.
On Friday, 10 August 2018 at 12:15:55 UTC, Ivan Kazmenko wrote:
Hi,
How should I set up DMD to be able to `dmd -m64` on Windows
nowadays?
I usually download the 7z, but it broke when I replaced my
Visual Studio with 2017 edition.
Now, I tried the current 2.081.1 .exe installer. It didn't
On Friday, 10 August 2018 at 09:33:34 UTC, Timoses wrote:
On Thursday, 9 August 2018 at 21:59:24 UTC, Johannes Loher
wrote:
I already posted this in the vibe.d forums
(https://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/58891/), but it seems, there is not a lot of activity ov
On Friday, 10 August 2018 at 18:23:28 UTC, Johannes Loher wrote:
On Friday, 10 August 2018 at 09:33:34 UTC, Timoses wrote:
On Thursday, 9 August 2018 at 21:59:24 UTC, Johannes Loher
wrote:
I already posted this in the vibe.d forums
(https://forum.rejectedsoftware.com/groups/rejectedsoftware.vib
T myfunc(T)( T x, uint mask )
if ( mask == 3 )
{
return fast_func( x, mask );
}
but of course this doesn't work because mask is not known at
compile-time. so I wondered if there is a way to do something
like static if ( isKnownAtCompileTime( mask ) ) but that would
not necessarily
On Saturday, 11 August 2018 at 05:17:51 UTC, Cecil Ward wrote:
T myfunc(T)( T x, uint mask )
if ( mask == 3 )
{
return fast_func( x, mask );
}
but of course this doesn't work because mask is not known at
compile-time.
Actually is there an opportunity for some kind of language
enh
33 matches
Mail list logo