Re: Passing a byLine as an argument to InputRange

2021-05-13 Thread Jeff via Digitalmars-d-learn

On Thursday, 13 May 2021 at 18:29:08 UTC, Ali Çehreli wrote:

On 5/13/21 10:07 AM, Jeff wrote:

> I have a class where I'd like to supply it with an
InputRange!string.
> Yet, for the life of me I can't seem to pass to it a
File.byLine

As Adam said, your range elements need to be converted to 
string e.g. with 'text' (the same as to!string). However, you 
must also create a dynamic InputRange!string object for dynamic 
polymorphism that InputRange provides. And that's achieved by 
function inputRangeObject():




Thank you all. I'm up and running. ;-)


Passing a byLine as an argument to InputRange

2021-05-13 Thread Jeff via Digitalmars-d-learn
I have a class where I'd like to supply it with an 
InputRange!string. Yet, for the life of me I can't seem to pass 
to it a File.byLine, even though the documentation states it's an 
InputRange.


```
class Foo {
  private InputRange!string source;

  this(InputRange!string s) {
source = s;
  }

  // do stuff with it
}

new Foo(File("stuff.txt").byLine);

// Error constructor Foo.this(InputRange!string) is not callable 
using argument types (ByLineImpl!(char, char))

```

I have to believe this is possible. I'm thinking maybe I need to 
template the constructor with something like:


```
this(R)(R s) if (isInputRange!R)
```

But, then I seem to have 2 problems:

1. I haven't ensured it's an InputRange!string
2. I've just punted the problem up a level, because my member 
variable doesn't work.


Any help appreciated. Thanks!



Unary operators for Variants

2021-03-09 Thread Jeff via Digitalmars-d-learn
So, I can't seem to get unary operators to work with variants. 
For example:


Variant x = 10;
writeln(-x); // Error: x is not of arithmetic type, it is a 
VariantN!32LU


Obviously binary operators like + work fine. Is there a reason 
opUnary wasn't implemented as well? Is there a work-around for me 
to implement it myself outside of the VariantN class?


Thanks!


Re: Traits of variadic templates

2021-02-09 Thread Jeff via Digitalmars-d-learn

On Tuesday, 9 February 2021 at 16:25:46 UTC, Paul Backus wrote:

On Tuesday, 9 February 2021 at 16:22:16 UTC, Jeff wrote:
But, those don't work because T is a Tuple of the types. Is 
there some trait combination I can use to do this? Something 
like (obviously made up)...


all(TemplateArgsOf!T, t => isIntegral!t || isSomeString!t)

Thanks!


import std.meta: allSatisfy, Or = templateOr;
allSatisfy!(Or!(isIntegral, isSomeString), T);

http://phobos.dpldocs.info/std.meta.allSatisfy.html
http://phobos.dpldocs.info/std.meta.templateOr.html


Thanks so much!



Traits of variadic templates

2021-02-09 Thread Jeff via Digitalmars-d-learn

Let's say I have...

void foo(T...)(T xs)
{
foreach(x; xs)
{
if (typeid(x) == typeid(int))
writeln("int: ", x);
else
writeln("str: ", x);
}
}

From the body, it's obvious I really only want int or string to 
be passed in to foo. Ideally, this check would be done at 
compile-time.


Obviously, I could modify foo to something like:

void foo(Algebraic!(int, string)[] xs)

I could also put checks in the body at runtime. But, for the sake 
of this thread, let's not. ;-)


What would be ideal (IMO) would be something along the lines of:

void foo(T...)(T xs) if (isIntegral!T || isSomeString!T)

But, those don't work because T is a Tuple of the types. Is there 
some trait combination I can use to do this? Something like 
(obviously made up)...


all(TemplateArgsOf!T, t => isIntegral!t || isSomeString!t)

Thanks!


Re: Can someone explain this?

2021-02-06 Thread Jeff via Digitalmars-d-learn

On Saturday, 6 February 2021 at 15:00:45 UTC, Adam D. Ruppe wrote:

On Saturday, 6 February 2021 at 14:39:38 UTC, Jeff wrote:

Okay, the above works. But, I'm not sure why?


Phobos's enum conversion always looks at the identifier, 
whereas the rest of the language looks at the value.


...


to!string(op) // goes through the library's conversion


This makes sense and is what I was missing.

Thanks!



Re: Can someone explain this?

2021-02-06 Thread Jeff via Digitalmars-d-learn

Also wanted to note that if I do:

string enumValue = op;
writeln(enumValue);

Then it also outputs foo and bar. So, why would the behavior of 
op.to!string not be the same?




Can someone explain this?

2021-02-06 Thread Jeff via Digitalmars-d-learn
I'm trying to get the values of an enum at compile-time and 
running into a behavior I don't understand.


Consider the following enum:

enum A {x="foo", y="bar"}

And now, I just want to print out the values of A at runtime 
(e.g. A.x = "foo").


void main()
{
static foreach(i, op; EnumMembers!A)
{
writeln("A." ~ op.to!string ~ " = " ~ op);
}
}

Okay, the above works. But, I'm not sure why?

If I just do writeln(op), it prints out x and y, which is the 
same if I do op.to!string. If I use a mixin... mixin("\"" ~ op ~ 
"\"") then it prints foo and bar.


So, I'm guessing there's something going on under-the-hood using 
the ~ operator with the enum and I'd like to understand what it 
is.


Likewise, if there's an easier method of getting the "value of 
enum" I haven't discovered yet, that'd be just as nice to know. ;)


Thanks!


Re: dlib 0.19.1 seems to be failing linking with ldc2

2020-08-02 Thread jeff thompson via Digitalmars-d-learn

On Friday, 31 July 2020 at 22:26:26 UTC, jeff thompson wrote:

On Friday, 31 July 2020 at 20:07:26 UTC, Dennis wrote:

On Friday, 31 July 2020 at 14:17:14 UTC, jeff thompson wrote:
dlib.lib(dlib.audio.io.wav.obj) : error LNK2019: unresolved 
external symbol 
_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv 
referenced in function 
_D3std6format__T10printFloatTfTaZQrFNaNfNkAafSQBsQBr__T10FormatSpecTaZQpEQCtQCs12RoundingModeZQCa
dlib.lib(dlib.filesystem.local.obj) : error LNK2001: 
unresolved external symbol 
_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv

.dub\build\application-debug-windows-x86_64-ldc_2092-316AB5B187D20C1F6AFBA496E604908D\test.exe
 : fatal error LNK1120: 1 unresolved externals



The first thing you want to do is demangle the symbols so you 
know what they really are.

You can use the tool `ddemangle` for that:
```
echo 
'_D3std6format__T10printFloatTfTaZQrFNaNfNkAafSQBsQBr__T10FormatSpecTaZQpEQCtQCs12RoundingModeZQCa' | ddemangle

```

You'll find that this symbol is missing:

pure nothrow @nogc @safe void 
core.internal.switch_.__switch_error!().__switch_error(immutable(char)[], ulong)


And it's used in this function:

pure @safe char[] std.format.printFloat!(float, 
char).printFloat(return char[], float, 
std.format.FormatSpec!(char).FormatSpec, 
std.format.RoundingMode)


The switch_error function is called when none of the cases of 
a `final switch` apply. There is a final switch in 
std.format.printFloat:

https://github.com/ldc-developers/phobos/blob/c43cafe53746a07dee8fa9e00d3a2256c7f05506/std/format.d#L7096

So why is the compiler not emitting the final switch error 
template function? I am not sure, it could be a bug, or maybe 
you have some funky dub settings. You might be able to work 
around this by defining a final switch in you own code 
somewhere, or explicitly defining the function.


```
pragma(mangle, 
"_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv")

void switchError(string file, ulong line) {
assert(0, file);
}
```

I hope someone else with more familiarity of how template 
symbols are emitted can find the root of this problem and give 
a proper fix.


Thanks! From looking at it, isn't happening in 
dlib.lib(dlib.audio.io.wav.obj)? Also this is with a test 
program with nothing but an empty main and a dependency on dlib 
0.19.1. I
 guess ill post something in their github since it does compile 
and link with dmd


Ok so the scenario is a dub project A that has a dependency on 
another dub project B who is using dlib. Compiling project A with 
the dependency with ldc produces the error


Re: dlib 0.19.1 seems to be failing linking with ldc2

2020-07-31 Thread jeff thompson via Digitalmars-d-learn

On Friday, 31 July 2020 at 20:07:26 UTC, Dennis wrote:

On Friday, 31 July 2020 at 14:17:14 UTC, jeff thompson wrote:
dlib.lib(dlib.audio.io.wav.obj) : error LNK2019: unresolved 
external symbol 
_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv 
referenced in function 
_D3std6format__T10printFloatTfTaZQrFNaNfNkAafSQBsQBr__T10FormatSpecTaZQpEQCtQCs12RoundingModeZQCa
dlib.lib(dlib.filesystem.local.obj) : error LNK2001: 
unresolved external symbol 
_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv

.dub\build\application-debug-windows-x86_64-ldc_2092-316AB5B187D20C1F6AFBA496E604908D\test.exe
 : fatal error LNK1120: 1 unresolved externals



The first thing you want to do is demangle the symbols so you 
know what they really are.

You can use the tool `ddemangle` for that:
```
echo 
'_D3std6format__T10printFloatTfTaZQrFNaNfNkAafSQBsQBr__T10FormatSpecTaZQpEQCtQCs12RoundingModeZQCa' | ddemangle

```

You'll find that this symbol is missing:

pure nothrow @nogc @safe void 
core.internal.switch_.__switch_error!().__switch_error(immutable(char)[], ulong)


And it's used in this function:

pure @safe char[] std.format.printFloat!(float, 
char).printFloat(return char[], float, 
std.format.FormatSpec!(char).FormatSpec, 
std.format.RoundingMode)


The switch_error function is called when none of the cases of a 
`final switch` apply. There is a final switch in 
std.format.printFloat:

https://github.com/ldc-developers/phobos/blob/c43cafe53746a07dee8fa9e00d3a2256c7f05506/std/format.d#L7096

So why is the compiler not emitting the final switch error 
template function? I am not sure, it could be a bug, or maybe 
you have some funky dub settings. You might be able to work 
around this by defining a final switch in you own code 
somewhere, or explicitly defining the function.


```
pragma(mangle, 
"_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv")

void switchError(string file, ulong line) {
assert(0, file);
}
```

I hope someone else with more familiarity of how template 
symbols are emitted can find the root of this problem and give 
a proper fix.


Thanks! From looking at it, isn't happening in 
dlib.lib(dlib.audio.io.wav.obj)? Also this is with a test program 
with nothing but an empty main and a dependency on dlib 0.19.1. I 
 guess ill post something in their github since it does compile 
and link with dmd


Re: dlib 0.19.1 seems to be failing linking with ldc2

2020-07-31 Thread jeff thompson via Digitalmars-d-learn

Also this is on x86_x64 box and the 2019 MSVC toolchain




dlib 0.19.1 seems to be failing linking with ldc2

2020-07-31 Thread jeff thompson via Digitalmars-d-learn

Hello

Im using dlib 0.19.1 with a project and compiling with ldc2 1.22 
its failing with the error below. This works fine with the latest 
dmd version. My targetType is a static lib, only other 
dependencies are latest bindbc-glfw and bindbc-gl


Performing "debug" build using ldc2.exe for x86_64.
dlib ~master: target for configuration "library" is up to date.
sandbox ~master: building configuration "application"...
Linking...
dlib.lib(dlib.audio.io.wav.obj) : error LNK2019: unresolved 
external symbol 
_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv 
referenced in function 
_D3std6format__T10printFloatTfTaZQrFNaNfNkAafSQBsQBr__T10FormatSpecTaZQpEQCtQCs12RoundingModeZQCa
dlib.lib(dlib.filesystem.local.obj) : error LNK2001: unresolved 
external symbol 
_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv

.dub\build\application-debug-windows-x86_64-ldc_2092-316AB5B187D20C1F6AFBA496E604908D\test.exe
 : fatal error LNK1120: 1 unresolved externals

Anyone else seeing this?


Re: dub build to generate different kinds of libs

2020-07-29 Thread jeff thompson via Digitalmars-d-learn

On Wednesday, 29 July 2020 at 13:26:45 UTC, Andre Pany wrote:

On Tuesday, 28 July 2020 at 22:10:58 UTC, jeff thompson wrote:
On Tuesday, 28 July 2020 at 22:08:14 UTC, Steven Schveighoffer 
wrote:

[...]


Thanks Steve!, ya i know i can call build twice but i was 
wondering if there was any config magic for dub to make it 
output multiple library types in one call to build


As far as I remember if you set the targetType of the main 
package to none it build all the sub packages in one call. 
Therefore you have 2 sub packages instead of 2 configurations.


But I have to say I have never done it myself, but just saw the 
pr which should implement this behavior.


Kind regards
Andre


Awesome, cant wait to get that ability, as far as my issue i was 
being a D newb and was setting everything up incorrectly. Im all 
good now. Thanks


-J


Re: dub build to generate different kinds of libs

2020-07-28 Thread jeff thompson via Digitalmars-d-learn
On Tuesday, 28 July 2020 at 22:08:14 UTC, Steven Schveighoffer 
wrote:

On 7/28/20 5:50 PM, jeff thompson wrote:

Hello

Im brand new to D (loving it btw!) and have decided to build a 
largish windows project in the language. First question, is 
there a dub.json setup to have a dub build to generate 
multiple binaries in one call? Like a dll and a static lib. 
Seems like it would be easy maybe im missing something 
obvious? Like a configuration with multiple targetTypes.


Yes, just do that (make multiple configurations)

You just have to build them separately:

dub build --config=library
dub build --config=application

-Steve


I got it figured out, thank you


Re: dub build to generate different kinds of libs

2020-07-28 Thread jeff thompson via Digitalmars-d-learn
On Tuesday, 28 July 2020 at 22:08:14 UTC, Steven Schveighoffer 
wrote:

On 7/28/20 5:50 PM, jeff thompson wrote:

Hello

Im brand new to D (loving it btw!) and have decided to build a 
largish windows project in the language. First question, is 
there a dub.json setup to have a dub build to generate 
multiple binaries in one call? Like a dll and a static lib. 
Seems like it would be easy maybe im missing something 
obvious? Like a configuration with multiple targetTypes.


Yes, just do that (make multiple configurations)

You just have to build them separately:

dub build --config=library
dub build --config=application

-Steve


Thanks Steve!, ya i know i can call build twice but i was 
wondering if there was any config magic for dub to make it output 
multiple library types in one call to build


dub build to generate different kinds of libs

2020-07-28 Thread jeff thompson via Digitalmars-d-learn

Hello

Im brand new to D (loving it btw!) and have decided to build a 
largish windows project in the language. First question, is there 
a dub.json setup to have a dub build to generate multiple 
binaries in one call? Like a dll and a static lib. Seems like it 
would be easy maybe im missing something obvious? Like a 
configuration with multiple targetTypes.


Thanks
J


Re: dub build to generate different kinds of libs

2020-07-28 Thread jeff thompson via Digitalmars-d-learn
I saw this 
https://github.com/dlang/dub/wiki/Cookbook#creating-a-library-package-that-also-comes-with-an-executable


But it didnt result in creating both a dll or exe and a .lib


Re: Unpack Variadic Args?

2020-02-13 Thread Jeff via Digitalmars-d-learn

On Thursday, 13 February 2020 at 08:06:52 UTC, Paul Backus wrote:

On Thursday, 13 February 2020 at 07:06:49 UTC, Jeff wrote:

Hello,

Was wondering if there was a simple, efficient way to unpack a 
variadic template argument. It needs to be efficient at 
runtime, and hopefully not use too much excessive CTFE.


C++ has the "..." operator, is there something equivalent in D?

template
void g(Args... args) {
f(foo(args)...); // f(foo(args[0]), foo(args[1])); // 
etc

}

What would be a good way to write that in D, with it being as 
efficient (no copies or building structs etc) and not use too 
much CTFE. Needing to use `.map` or similar at CTFE would be 
an example of too much CTFE.


void g(Args...)(auto ref Args args) {
 // ?
}


Variadic template arguments unpack automatically in D, so you 
don't need to do anything special here:


void g(Args...)(auto ref Args args) {
import core.lifetime: forward; // like std::forward
f(forward!args);
}

You can read more about variadic template arguments in this 
article:


https://dlang.org/articles/ctarguments.html


That would result in the call:

f( args[0], args[1], ... );

But the C++ version does the following:

f( foo(args[0]), foo(args[1]), ... );

They are different.


Unpack Variadic Args?

2020-02-12 Thread Jeff via Digitalmars-d-learn

Hello,

Was wondering if there was a simple, efficient way to unpack a 
variadic template argument. It needs to be efficient at runtime, 
and hopefully not use too much excessive CTFE.


C++ has the "..." operator, is there something equivalent in D?

template
void g(Args... args) {
f(foo(args)...); // f(foo(args[0]), foo(args[1])); // etc
}

What would be a good way to write that in D, with it being as 
efficient (no copies or building structs etc) and not use too 
much CTFE. Needing to use `.map` or similar at CTFE would be an 
example of too much CTFE.


void g(Args...)(auto ref Args args) {
 // ?
}


Re: "inline" conversion of array to immutable

2016-04-22 Thread Jeff Thompson via Digitalmars-d-learn

On Friday, 22 April 2016 at 11:16:59 UTC, ag0aep6g wrote:
It's a nested function now. That means, it could reference 
local variables of main. Make func static and it works.


You can also use a function literal:

void main()
{
  immutable int[] array = {
int[] result = new int[10];
result[0] = 1;
return result;
  }();
}


Great! Making it static works. The function literal also works if 
I add "function int[]()":

void main(string[] args) {
  immutable int[] array = function int[]() {
int[] result = new int[10];
result[0] = 1;
return result;
  }();
}



Re: "inline" conversion of array to immutable

2016-04-22 Thread Jeff Thompson via Digitalmars-d-learn

On Friday, 22 April 2016 at 09:40:14 UTC, FreeSlave wrote:

On Friday, 22 April 2016 at 09:25:32 UTC, Jeff Thompson wrote:
Hello. The following code compiles OK where func creates a 
mutable array and main assigns it to an immutable variable:


[...]


Probably this is what you look for 
http://dlang.org/phobos/std_exception.html#.assumeUnique


OK, we lose the compiler check for correctness. What if I put 
func directly in main with the hopes that the compiler will check 
correctness and also inline the function? But it won't assign to 
the immutable array. Why not? It's the same function.


void main(string[] args) {
  int[] func(int x) pure {
int[] result = new int[10];
result[0] = x;
return result;
  }
  immutable int[] array = func(1);
}



"inline" conversion of array to immutable

2016-04-22 Thread Jeff Thompson via Digitalmars-d-learn
Hello. The following code compiles OK where func creates a 
mutable array and main assigns it to an immutable variable:


int[] func(int x) pure {
  int[] result = new int[10];
  result[0] = x;
  return result;
}

void main(string[] args)
{
  immutable int[] array = func(1);
}

I assume this works because func is pure so that the compiler 
knows that its return value won't be changed by some other code. 
But it doesn't compile when I put the same code from func 
"inline" into main:


void main(string[] args)
{
  int[] result = new int[10];
  result[0] = 1;
  immutable int[] array = result;
}

I could forcibly cast result to immutable int[], but that seems 
error-prone. How to tell the compiler that result will not be 
changed after assigning to array so that the immutable assignment 
compiles?


Re: immutable array in constructor

2016-03-19 Thread Jeff Thompson via Digitalmars-d-learn

On Thursday, 17 March 2016 at 11:27:01 UTC, Rene Zwanenburg wrote:

On Thursday, 17 March 2016 at 10:11:43 UTC, Jeff Thompson wrote:
This is a simplified example from a larger class I have where 
I need an immutable constructor. This is because I need to 
construct an object an pass it to other functions which take 
an immutable object. So, how to keep an immutable constructor?


In that case, new immutable C() should work I believe. Also, if 
you mark the constructor as pure, new C() should be implicitly 
convertible to an immutable C.


new immutable C() worked! Thanks for the insight.


Re: immutable array in constructor

2016-03-19 Thread Jeff Thompson via Digitalmars-d-learn

On Thursday, 17 March 2016 at 10:04:53 UTC, Anonymouse wrote:

On Thursday, 17 March 2016 at 09:57:37 UTC, Jeff Thompson wrote:
In the following code, I explicitly declare array as 
immutable. But it compiles with the error shown below in the 
comment. The array object is declared immutable, so how can 
the compiler say it is a mutable object? In summary, how to 
pass an immutable array to an immutable constructor?


class C {
  int i;
  this(immutable int[] array) immutable {
i = array[0];
  }
}

void func() {
  immutable int[] array = [1];
  auto c = new C(array); // Error: immutable method C.this is 
not callable using a mutable object

}


The error message isn't very good, but remove immutable from 
the constructor and it works.

  this(immutable int[] array) {


This is a simplified example from a larger class I have where I 
need an immutable constructor. This is because I need to 
construct an object an pass it to other functions which take an 
immutable object. So, how to keep an immutable constructor?


immutable array in constructor

2016-03-18 Thread Jeff Thompson via Digitalmars-d-learn
In the following code, I explicitly declare array as immutable. 
But it compiles with the error shown below in the comment. The 
array object is declared immutable, so how can the compiler say 
it is a mutable object? In summary, how to pass an immutable 
array to an immutable constructor?


class C {
  int i;
  this(immutable int[] array) immutable {
i = array[0];
  }
}

void func() {
  immutable int[] array = [1];
  auto c = new C(array); // Error: immutable method C.this is not 
callable using a mutable object

}



GtkD DLL issues

2013-04-23 Thread Jeff
Trying out GtkD for the first time today, compiled one of the 
sample applications and when I try to run it, it instantly 
crashes with the following error message: The image file 
C:\Program Files\Intel\WiFi\bin\zlib1.dll is valid, but is for a 
machine type other than that current machine. Select OK to 
continue, or CANCEL to fail the DLL load.


I've looked around and found people with similar problems, but 
nothing that seems to solve my problem.


Using:
Windows 8 (64 bit)
DMD v2.062
GtkD v2.1.1

Code:
import gtk.MainWindow;
import gtk.Label;
import gtk.Main;

void main(string[] args)
{
Main.init(args);
MainWindow win = new MainWindow(Hello World);
win.setDefaultSize(200, 100);
win.add(new Label(Hello World));
win.showAll();

Main.run();
}

Any help would be much appreciated.


Re: GtkD DLL issues

2013-04-23 Thread Jeff

On Tuesday, 23 April 2013 at 20:21:51 UTC, Mike Wey wrote:

On 04/23/2013 09:00 PM, Jeff wrote:
Trying out GtkD for the first time today, compiled one of the 
sample
applications and when I try to run it, it instantly crashes 
with the

following error message: The image file C:\Program
Files\Intel\WiFi\bin\zlib1.dll is valid, but is for a machine 
type other
than that current machine. Select OK to continue, or CANCEL to 
fail the

DLL load.

I've looked around and found people with similar problems, but 
nothing

that seems to solve my problem.

Using:
Windows 8 (64 bit)
DMD v2.062
GtkD v2.1.1

Code:
import gtk.MainWindow;
import gtk.Label;
import gtk.Main;

void main(string[] args)
{
Main.init(args);
MainWindow win = new MainWindow(Hello World);
win.setDefaultSize(200, 100);
win.add(new Label(Hello World));
win.showAll();

Main.run();
}

Any help would be much appreciated.


Are you compiling gtkD and the app as 32 or 64 bit?
Did you install the matching Gtk+ runtime 32 or 64 bits?

I looks like its pikking up a different version of a dll used 
by Gtk+ and apperantly the Intel WiFi tools. But think it 
should loadthe right one if ist just 32 vs 64 bits.


Both as 32.


Re: GtkD DLL issues

2013-04-23 Thread Jeff

On Tuesday, 23 April 2013 at 20:24:33 UTC, Jeff wrote:

On Tuesday, 23 April 2013 at 20:21:51 UTC, Mike Wey wrote:

On 04/23/2013 09:00 PM, Jeff wrote:
Trying out GtkD for the first time today, compiled one of the 
sample
applications and when I try to run it, it instantly crashes 
with the

following error message: The image file C:\Program
Files\Intel\WiFi\bin\zlib1.dll is valid, but is for a machine 
type other
than that current machine. Select OK to continue, or CANCEL 
to fail the

DLL load.

I've looked around and found people with similar problems, 
but nothing

that seems to solve my problem.

Using:
Windows 8 (64 bit)
DMD v2.062
GtkD v2.1.1

Code:
import gtk.MainWindow;
import gtk.Label;
import gtk.Main;

void main(string[] args)
{
   Main.init(args);
   MainWindow win = new MainWindow(Hello World);
   win.setDefaultSize(200, 100);
   win.add(new Label(Hello World));
   win.showAll();

   Main.run();
}

Any help would be much appreciated.


Are you compiling gtkD and the app as 32 or 64 bit?
Did you install the matching Gtk+ runtime 32 or 64 bits?

I looks like its pikking up a different version of a dll used 
by Gtk+ and apperantly the Intel WiFi tools. But think it 
should loadthe right one if ist just 32 vs 64 bits.


Both as 32.


Oh, and using the 32-bit runtime as well.


Re: GtkD DLL issues

2013-04-23 Thread Jeff

On Tuesday, 23 April 2013 at 21:16:03 UTC, ollie wrote:
Then it's indeed picing up the copy of zlib1.dll installed 
with the

Intel WiFi tools instead of the one installed with Gtk+.

But i don't know what could be done about that.


Try opening a command prompt (cmd.exe) and setting the path of 
the gtk

runtime before the Intel Wifi tools.

set PATH=C:\Path\To\GtkRuntime\bin;%PATH%

This will use the gtk runtime zlib1.dll first.  If that works 
and doesn't
mess up your intel wifi program, you can make that a global 
path setting.


Thanks, that did the trick.  Should've know it was just a %PATH% 
issue.


Re: Linking with/Debugging static C/C++ libraries

2011-05-30 Thread Jeff Slutter
On 5/30/2011 10:57 AM, Dmitry Olshansky wrote:
 It was me who brought it Unilink out of infernal abyss :)  See also:
 http://www.digitalmars.com/d/archives/digitalmars/D/announce/Alternative_linker_win32_64_20086.html
 
 
 Seriously I still suggest to try it out, and at any rate author showed
 quite a motivation and provided full D support in no time.
 (there is little problem that he won't use CV debug symbols... and
 UniLink _converts_ them to Borland's TDS format)
 Still it's now possible to use any linker with VisualD, using 'compile
 only' option (in fact I just tried it out myself).

I will give it a try.

With the Borland TDS debug symbols, that means no debugging with
VisualD/Visual Studio right? (No CodeView, No PDB)


 Right and I've seen this cool option 'use other compiler' in recent
 VisualD with textbox for command line. So GDC  LDC support is almost
 there.

I missed that, so that's exciting!


Linking with/Debugging static C/C++ libraries

2011-05-29 Thread Jeff Slutter
I'm just starting out in my journey of RD/evaluation of using D, as a
possible future development platform, for my team at work. I like a lot
of what I see!

Currently we do all our development in Visual Studio, using C/C++ (and
C# for some tools), and it is definitely the 'comfort zone' for the
team. My goal is to reduce the learning curves, and new tools they'll
have to pick up. The Visual D project is of great interest to me.

One of the things that's important to us is being able to link against
some existing C/C++ static libraries (built with VS 2008, so PE COFF
format). In some light testing I was able to link a D2 project with a
C/C++ Static library project in VS/VisualD with DMD. I had to use the
objconv.exe tool, as the Digital Mars tool coff2omf.exe seems to be too
old to work with the newer MS generated libraries. Unfortunately, it
looks like objconv will always strip out debugging information, and
while I had successful link and execution, I could only debug the D
code, there was no debugging information for the C/C++ code.

I suppose if the C/C++ code was in a DLL and D referenced the import
lib, things would work much better, but there are some cases where our
applications really need to come as a single executable and not have
dependent DLLs along for the ride.

Am I missing some sort of process or tool to make this all happen how I
want? I want to be able to link C/C++ static libraries, generated with
Visual Studio, with DMD, and maintain debugging information. Yes, I
know, that is not a simple request. :)

For what it's worth, using GDC and GCC/MingW (TDM), I was able to build
and debug a D/C/C++ mixed executable. I had to use GDB (though WinGDB
works just dandy), but the downside is I'm not using Visual D (unless
Visual D supports GDC??), nor DMD. DMD seems that it would be more
supported and stable right now than GDC, which seems to play catch up. I
worry that, as a user of GDC, hitting a compiler bug, would take longer
to get an official fix for, than it would for DMD.

Thanks everyone...
Jeff