Re: tango -D2 regex

2013-12-16 Thread evilrat

On Monday, 16 December 2013 at 07:46:30 UTC, seany wrote:

I dont find any info on backtrack on tango-D2 regex.

For example, I want to match things like

barFOObar

or

bazFOObaz

so I would use, in PCRE, ^(\w*)FOO($1)$, with $1 meaning the 
word (given by \w*  that was matced in the first subpattern 
(\w*)


How to do the samein Tango for D2 (or even phobos for D2)?


have you tried look the docs first?

phobos regex patterns described here
http://dlang.org/phobos/std_regex.html



Re: Path to cmdfile?

2013-12-16 Thread evilrat

On Monday, 16 December 2013 at 07:33:47 UTC, Jeremy DeHaan wrote:
I've been brain storming lately on some ideas to simplify 
building for the library I've been working on, and I wanted to 
do some experimenting using cmdfiles. Is there some way that I 
can pass a search path for these bad boys to the compiler if 
they are just text files?


don't know about that, but there is string mixin search paths - 
using it with mixins may be possible alternative for what you 
trying to achieve(assuming you are using handmade D build script).


and also depending on your needs it may worth look at dub[1,2].

[1] http://code.dlang.org/download
[2] https://github.com/rejectedsoftware/dub


Re: tango -D2 regex

2013-12-16 Thread seany

On Monday, 16 December 2013 at 07:56:53 UTC, evilrat wrote:



have you tried look the docs first?

phobos regex patterns described here
http://dlang.org/phobos/std_regex.html


The only mention of backtrack is : bmatch
it returns a regex object with a machine state, and last match, 
but it is still not telling me how to actually do a backtrack 
match. I.e. if i know the machine state and a match (in my 
example, does that mean that foo is returned as a match or does 
it mean thatbaz /bar is returned as a match, and the next attempt 
will match the bar/baz - if not, then what is the call sequence? 
bmatch (match bar/baz) then match FOO, then again try to match 
what bmatch returned?)




Re: Error: import `typename` is used as a type

2013-12-16 Thread Dfr


 Thank you, it's now works with full type name.


On Monday, 16 December 2013 at 06:33:14 UTC, Dfr wrote:

Hello, i struggling now to make my D program better organized.
As suggested here 
https://github.com/bioinfornatics/MakefileForD, i put all 
source files to src. Here is my current directory tree:


./
 Makefile
 src/
   main.d
   pcre/
 capi.d
 pcre_regex.d

Then i run make:

$ make
dmd -O -d -m32 -L-ldl -m32   -Isrc -c src/pcre/pcre_regex.d 
-ofbuild/src/pcre/pcre_regex.o
src/pcre/pcre_regex.d(79): Error: import pcre_regex.pcre is 
used as a type


What it could be ?

pcre is defined in pcre/capi.d as:

struct pcre {}

Then it is used in pcre_regex.d this way:

import pcre.capi;

class RegExp {
private pcre* _ppcre;  // -- Error: import pcre_regex.pcre is 
used as a type

...
}


it doesn't know what do you need, since there is two or more 
possible variants(pcre(package), pcre(struct), ...), so in such 
places just fully specify type name


class RegExp {
private pcre.capi.pcre _ppcre;
...
}




Re: regarding spawnProcess and parameters in Windows

2013-12-16 Thread Hugo Florentino

On Mon, 16 Dec 2013 02:04:10 +0100, Danny Arends wrote:

...
So I think this should work:

spawnProcess([appexe,format(/INI=%s,appini)],
[,],Config.suppressConsole);



Hmm... that did not work either, it complained that the parameter was 
not correct. Actually, the syntax I was using should have worked 
(according to documentation, second overload of spawnProcess), and I 
also (unsuccessfully) tried with function execute.


Anyway, since my launcher will only be run from Windows, finally I 
decided to call ShellExecuteA directly (I find it less cumbersome to use 
and actually more elegant).


However, something is bothering me: when running the launcher, it opens 
a console temporarily before launching the other process (even when I am 
not using std.stdio) and I cannot get rid of this behavior.


This is the code I am now using:

import std.file: exists, getcwd;
import std.path: buildPath, dirName;
import std.string: format, toStringz;
import core.sys.windows.windows;

immutable static auto appname = myapp;

extern(Windows) HANDLE ShellExecuteA(HWND, LPCSTR, LPCSTR, LPCSTR, 
LPCSTR, int);


int main(string[] args) {
  auto appath = getcwd();
  auto appexe = buildPath(appath, appname ~ .exe);
  if (exists(appexe)) {
auto param = format(`/ini=%s`, buildPath(appath, appname ~ 
.ini));
ShellExecuteA(null, , toStringz(appexe), toStringz(param), , 
SW_SHOWMAXIMIZED);

scope(failure) return -1;
  }
  return 0;
}

Why does the console window appear and how can I prevent this?

Regards, Hugo


Re: regarding spawnProcess and parameters in Windows

2013-12-16 Thread Mike Parker

On 12/16/2013 6:33 PM, Hugo Florentino wrote:

On Mon, 16 Dec 2013 02:04:10 +0100, Danny Arends wrote:




However, something is bothering me: when running the launcher, it opens
a console temporarily before launching the other process (even when I am
not using std.stdio) and I cannot get rid of this behavior.

This is the code I am now using:

import std.file: exists, getcwd;
import std.path: buildPath, dirName;
import std.string: format, toStringz;
import core.sys.windows.windows;

immutable static auto appname = myapp;

extern(Windows) HANDLE ShellExecuteA(HWND, LPCSTR, LPCSTR, LPCSTR,
LPCSTR, int);

int main(string[] args) {
   auto appath = getcwd();
   auto appexe = buildPath(appath, appname ~ .exe);
   if (exists(appexe)) {
 auto param = format(`/ini=%s`, buildPath(appath, appname ~ .ini));
 ShellExecuteA(null, , toStringz(appexe), toStringz(param), ,
SW_SHOWMAXIMIZED);
 scope(failure) return -1;
   }
   return 0;
}

Why does the console window appear and how can I prevent this?


This is how Windows works. There are a couple of ways to eliminate the 
console. One is to use WinMain instead of main. That requires some 
boilerplate, though, as it bypasses the main function in DRuntime, so 
you have to initialize the runtime manually. It has the benefit of being 
portable across compilers. Another way, which is what I always do, is to 
add this to the command line (assuming DMD with OPTLINK):


-L/SUBSYSTEM:WINDOWS:5.01

Every linker on Windows has some form of this flag. It may even be the 
same when using the VC toolchain. Also, you can drop the version number 
at the end. It depends on the minimum version of Windows you target and 
the target architecture (32-bit vs. 64-bit). Google it if you want to be 
sure of the details.




Re: How to link to libdl under linux

2013-12-16 Thread MrSmith

On Monday, 16 December 2013 at 07:36:12 UTC, Jacob Carlborg wrote:

On 2013-12-16 01:54, Danny Arends wrote:


Pass it depending if you use rdmd or dmd

-L-ldl

or

-ldl


It's -L-ldl regardless of it's rdmd or dmd.


now i'm getting this error:

deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_416_4ee.o): 
In function `_D8derelict4util9sharedlib13LoadSharedLibFAyaZPv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:60: 
undefined reference to `dlopen'
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_417_5d1.o): 
In function `_D8derelict4util9sharedlib15UnloadSharedLibFPvZv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:64: 
undefined reference to `dlclose'
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_418_396.o): 
In function `_D8derelict4util9sharedlib9GetSymbolFPvAyaZPv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:68: 
undefined reference to `dlsym'
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_419_463.o): 
In function `_D8derelict4util9sharedlib11GetErrorStrFZAya':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:72: 
undefined reference to `dlerror'

collect2: error: ld returned 1 exit status
--- errorlevel 1


Re: How to link to libdl under linux

2013-12-16 Thread MrSmith
You're still not linking ld properly. It would help 
tremendously if you could show the command line you're using. 
Otherwise all people can do is make guesses about what *might* 
be wrong.


Oh, right.
Here is first with /usr/lib32/libdl.a -L-ldl

andrey@andress-ubuntu:~/anchovy$ dmd -debug -gc -m32 
examples/fpshelper.d examples/main.d -Iimport -Ideps/dlib 
-Ideps/derelict-fi-master/source 
-Ideps/derelict-sdl2-master/source 
-Ideps/derelict-ft-master/source 
-Ideps/derelict-gl3-master/source 
-Ideps/derelict-glfw3-master/source 
-Ideps/derelict-util-1.0.0/source lib/debug/libgui.a 
lib/debug/libgraphics.a lib/debug/libcore.a 
lib/debug/libutils.a deps/dlib/libdlib.a 
deps/derelict-fi-master/lib/libDerelictFI.a 
deps/derelict-ft-master/lib/libDerelictFT.a 
deps/derelict-gl3-master/lib/libDerelictGL3.a 
deps/derelict-glfw3-master/lib/libDerelictGLFW3.a 
deps/derelict-util-1.0.0/lib/libDerelictUtil.a 
/usr/lib32/libdl.a -L-ldl -ofbin/guidemo


deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_416_4ee.o): 
In function `_D8derelict4util9sharedlib13LoadSharedLibFAyaZPv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:60: 
warning: Using 'dlopen' in statically linked applications 
requires at runtime the shared libraries from the glibc version 
used for linking

/usr/lib32/libdl.a(dlopen.o): In function `dlopen':
(.text+0x1b): undefined reference to `__dlopen'
/usr/lib32/libdl.a(dlclose.o): In function `dlclose':
(.text+0x1): undefined reference to `__dlclose'
/usr/lib32/libdl.a(dlsym.o): In function `dlsym':
(.text+0x1b): undefined reference to `__dlsym'
/usr/lib32/libdl.a(dlerror.o): In function `dlerror':
(.text+0x1): undefined reference to `__dlerror'
collect2: error: ld returned 1 exit status
--- errorlevel 1

Second with -L-ldl only

andrey@andress-ubuntu:~/anchovy$ dmd -debug -gc -m32 
examples/fpshelper.d examples/main.d -Iimport -Ideps/dlib 
-Ideps/derelict-fi-master/source 
-Ideps/derelict-sdl2-master/source 
-Ideps/derelict-ft-master/source 
-Ideps/derelict-gl3-master/source 
-Ideps/derelict-glfw3-master/source 
-Ideps/derelict-util-1.0.0/source lib/debug/libgui.a 
lib/debug/libgraphics.a lib/debug/libcore.a 
lib/debug/libutils.a deps/dlib/libdlib.a 
deps/derelict-fi-master/lib/libDerelictFI.a 
deps/derelict-ft-master/lib/libDerelictFT.a 
deps/derelict-gl3-master/lib/libDerelictGL3.a 
deps/derelict-glfw3-master/lib/libDerelictGLFW3.a 
deps/derelict-util-1.0.0/lib/libDerelictUtil.a -L-ldl 
-ofbin/guidemo


deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_416_4ee.o): 
In function `_D8derelict4util9sharedlib13LoadSharedLibFAyaZPv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:60: 
undefined reference to `dlopen'
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_417_5d1.o): 
In function `_D8derelict4util9sharedlib15UnloadSharedLibFPvZv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:64: 
undefined reference to `dlclose'
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_418_396.o): 
In function `_D8derelict4util9sharedlib9GetSymbolFPvAyaZPv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:68: 
undefined reference to `dlsym'
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_419_463.o): 
In function `_D8derelict4util9sharedlib11GetErrorStrFZAya':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:72: 
undefined reference to `dlerror'

collect2: error: ld returned 1 exit status
--- errorlevel 1


Re: regarding spawnProcess and parameters in Windows

2013-12-16 Thread Hugo Florentino

On Mon, 16 Dec 2013 18:59:52 +0900, Mike Parker wrote:

On 12/16/2013 6:33 PM, Hugo Florentino wrote:

...
Why does the console window appear and how can I prevent this?


This is how Windows works. There are a couple of ways to eliminate
the console. One is to use WinMain instead of main. That requires 
some

boilerplate, though, as it bypasses the main function in DRuntime, so
you have to initialize the runtime manually. It has the benefit of
being portable across compilers. Another way, which is what I always
do, is to add this to the command line (assuming DMD with OPTLINK):

-L/SUBSYSTEM:WINDOWS:5.01

Every linker on Windows has some form of this flag. It may even be
the same when using the VC toolchain. Also, you can drop the version
number at the end. It depends on the minimum version of Windows you
target and the target architecture (32-bit vs. 64-bit). Google it if
you want to be sure of the details.


That did the trick, thanks.

Now, suppose I have two versions of the application (myapp32.exe and 
myapp64.exe), and I want my launcher to launch either, based on the 
architecture it detected from the OS being run on. What could I do in 
this case, which is actually what I need to do? (I just started with the 
simpler variant)


how to detect OS architecture?

2013-12-16 Thread Hugo Florentino

Hi,

I am writing a launcher to make a Windows application portable, but 
since this application supports both x86 and x86_64, I would like to 
detect the architecture of the OS my launcher is being run on, in order 
to launch the proper executable.


How can I do this?

Regards, Hugo


Re: regarding spawnProcess and parameters in Windows

2013-12-16 Thread Hugo Florentino

On Mon, 16 Dec 2013 05:15:24 -0500, Hugo Florentino wrote:


Now, suppose I have two versions of the application (myapp32.exe and
myapp64.exe), and I want my launcher to launch either, based on the
architecture it detected from the OS being run on. What could I do in
this case, which is actually what I need to do? (I just started with
the simpler variant)


Disregard that (since Windows 64-bit can run 32-bit applications just 
fine), I made a new thread regarding the OS architecture detection.




Re: how to detect OS architecture?

2013-12-16 Thread Jeroen Bollen

On Monday, 16 December 2013 at 10:54:15 UTC, Hugo Florentino
wrote:

Hi,

I am writing a launcher to make a Windows application portable, 
but since this application supports both x86 and x86_64, I 
would like to detect the architecture of the OS my launcher is 
being run on, in order to launch the proper executable.


How can I do this?

Regards, Hugo


version(Windows) {
  // Windows code goes here
} else {
 // Other OS code goes here
}

More here: http://dlang.org/version.html


Re: how to detect OS architecture?

2013-12-16 Thread MrSmith

version(Windows) {
  // Windows code goes here
} else {
 // Other OS code goes here
}

More here: http://dlang.org/version.html


I think he wants determine at runtime what architecture x86 or 
x64 processor supprots and launch appropriate executable.


I think this is what he want 
http://dlang.org/phobos/core_cpuid.html#.isX86_64


Re: how to detect OS architecture?

2013-12-16 Thread Hugo Florentino

On Mon, 16 Dec 2013 12:40:17 +0100, MrSmith wrote:

version(Windows) {
  // Windows code goes here
} else {
 // Other OS code goes here
}

More here: http://dlang.org/version.html


I think he wants determine at runtime what architecture x86 or x64
processor supprots and launch appropriate executable.

I think this is what he want
http://dlang.org/phobos/core_cpuid.html#.isX86_64


Thanks, that's precisely what I needed :)


Re: how to detect OS architecture?

2013-12-16 Thread John Colvin
On Monday, 16 December 2013 at 10:54:15 UTC, Hugo Florentino 
wrote:

Hi,

I am writing a launcher to make a Windows application portable, 
but since this application supports both x86 and x86_64, I 
would like to detect the architecture of the OS my launcher is 
being run on, in order to launch the proper executable.


How can I do this?

Regards, Hugo


http://stackoverflow.com/questions/601089/detect-whether-current-windows-version-is-32-bit-or-64-bit

http://support.microsoft.com/kb/556009


To detect environment variables you can use 
std.process.environment.get


Re: how to detect OS architecture?

2013-12-16 Thread John Colvin
On Monday, 16 December 2013 at 11:56:07 UTC, Hugo Florentino 
wrote:

On Mon, 16 Dec 2013 12:40:17 +0100, MrSmith wrote:

version(Windows) {
 // Windows code goes here
} else {
// Other OS code goes here
}

More here: http://dlang.org/version.html


I think he wants determine at runtime what architecture x86 or 
x64

processor supprots and launch appropriate executable.

I think this is what he want
http://dlang.org/phobos/core_cpuid.html#.isX86_64


Thanks, that's precisely what I needed :)


Are you sure?

This will tell you about the processor, but not necessarily about 
what the OS supports. I don't know, but you may find that when 
using windows 32bit on an x64 machine, cpuid will tell you the 
cpu is 64bit, but the OS won't let you run any 64bit code.


[Repost] Link error?

2013-12-16 Thread Jack

Apparently I can't run link.exe.
I've set up the paths as intended.
Here:
C:\D\dm\bin;
C:\D\dmd2\windows\bin;
I've been trying to build gtkd with -m64 and this happens.
On Win7 64 bit.
Help?


Re: Language Support - Read and Write

2013-12-16 Thread Siavash Babaei
I am using Windows 7 Ultimate x64. Maybe PowerShell will do the 
trick!





Re: how to detect OS architecture?

2013-12-16 Thread Gary Willoughby
On Monday, 16 December 2013 at 10:54:15 UTC, Hugo Florentino 
wrote:

Hi,

I am writing a launcher to make a Windows application portable, 
but since this application supports both x86 and x86_64, I 
would like to detect the architecture of the OS my launcher is 
being run on, in order to launch the proper executable.


How can I do this?

Regards, Hugo


version (Windows)
{
version (X86_64)
{
// 64bit code.
}

version (X86)
{
32bit code.
}
}


Re: how to detect OS architecture?

2013-12-16 Thread Mike Parker

On 12/16/2013 9:26 PM, Gary Willoughby wrote:

On Monday, 16 December 2013 at 10:54:15 UTC, Hugo Florentino wrote:

Hi,

I am writing a launcher to make a Windows application portable, but
since this application supports both x86 and x86_64, I would like to
detect the architecture of the OS my launcher is being run on, in
order to launch the proper executable.

How can I do this?

Regards, Hugo


version (Windows)
{
 version (X86_64)
 {
 // 64bit code.
 }

 version (X86)
 {
 32bit code.
 }
}


That will tell him the version of Windows the executable was compiled 
on, but won't help him much when running a 32-bit executable on a 64-bit 
OS. He wants to detect the run-time architecture.


Re: How to link to libdl under linux

2013-12-16 Thread Mike Parker

On 12/16/2013 7:09 PM, MrSmith wrote:

You're still not linking ld properly. It would help tremendously if
you could show the command line you're using. Otherwise all people can
do is make guesses about what *might* be wrong.


Oh, right.
Here is first with /usr/lib32/libdl.a -L-ldl

andrey@andress-ubuntu:~/anchovy$ dmd -debug -gc -m32
examples/fpshelper.d examples/main.d -Iimport -Ideps/dlib
-Ideps/derelict-fi-master/source -Ideps/derelict-sdl2-master/source
-Ideps/derelict-ft-master/source -Ideps/derelict-gl3-master/source
-Ideps/derelict-glfw3-master/source
-Ideps/derelict-util-1.0.0/source lib/debug/libgui.a
lib/debug/libgraphics.a lib/debug/libcore.a lib/debug/libutils.a
deps/dlib/libdlib.a deps/derelict-fi-master/lib/libDerelictFI.a
deps/derelict-ft-master/lib/libDerelictFT.a
deps/derelict-gl3-master/lib/libDerelictGL3.a
deps/derelict-glfw3-master/lib/libDerelictGLFW3.a
deps/derelict-util-1.0.0/lib/libDerelictUtil.a /usr/lib32/libdl.a
-L-ldl -ofbin/guidemo

deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_416_4ee.o): In
function `_D8derelict4util9sharedlib13LoadSharedLibFAyaZPv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:60:
warning: Using 'dlopen' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
/usr/lib32/libdl.a(dlopen.o): In function `dlopen':
(.text+0x1b): undefined reference to `__dlopen'
/usr/lib32/libdl.a(dlclose.o): In function `dlclose':
(.text+0x1): undefined reference to `__dlclose'
/usr/lib32/libdl.a(dlsym.o): In function `dlsym':
(.text+0x1b): undefined reference to `__dlsym'
/usr/lib32/libdl.a(dlerror.o): In function `dlerror':
(.text+0x1): undefined reference to `__dlerror'
collect2: error: ld returned 1 exit status
--- errorlevel 1

Second with -L-ldl only

andrey@andress-ubuntu:~/anchovy$ dmd -debug -gc -m32
examples/fpshelper.d examples/main.d -Iimport -Ideps/dlib
-Ideps/derelict-fi-master/source -Ideps/derelict-sdl2-master/source
-Ideps/derelict-ft-master/source -Ideps/derelict-gl3-master/source
-Ideps/derelict-glfw3-master/source
-Ideps/derelict-util-1.0.0/source lib/debug/libgui.a
lib/debug/libgraphics.a lib/debug/libcore.a lib/debug/libutils.a
deps/dlib/libdlib.a deps/derelict-fi-master/lib/libDerelictFI.a
deps/derelict-ft-master/lib/libDerelictFT.a
deps/derelict-gl3-master/lib/libDerelictGL3.a
deps/derelict-glfw3-master/lib/libDerelictGLFW3.a
deps/derelict-util-1.0.0/lib/libDerelictUtil.a -L-ldl -ofbin/guidemo

deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_416_4ee.o): In
function `_D8derelict4util9sharedlib13LoadSharedLibFAyaZPv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:60:
undefined reference to `dlopen'
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_417_5d1.o): In
function `_D8derelict4util9sharedlib15UnloadSharedLibFPvZv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:64:
undefined reference to `dlclose'
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_418_396.o): In
function `_D8derelict4util9sharedlib9GetSymbolFPvAyaZPv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:68:
undefined reference to `dlsym'
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_419_463.o): In
function `_D8derelict4util9sharedlib11GetErrorStrFZAya':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:72:
undefined reference to `dlerror'
collect2: error: ld returned 1 exit status
--- errorlevel 1


For starters, remove /usr/lib32/libdl.a. All you need is -L-ldl. The 
-L flag tells DMD that what follows needs to be passed to the linker. 
-ldl tells the linker to link with libdl. It will link with the shared 
version, which is really what you want. As it stands, you're telling DMD 
to link with both the static version of libdl (which you don't have 
installed, I think, according to the error in your original post) and 
the shared version at the same time. I don't know if that's the source 
of your current linker errors, but it's certainly potentially problematic.


Also, since you aren't using dub to manage your project, I suggest you 
copy all of the Derelict libraries to a common location. Then, you can 
remove all of the */libDerelict*.a from the command line and do this 
instead:


-L-Lpath/to/libs -L-lDerelictFI -L-lDerelictGL3...

On the other hand, if you use dub to manage your project, all of this, 
including libdl, will be linked in for you automatically. Then your 
command line becomes:


dub build

during development and

dub build --build=release

when you're ready for the release version.


Re: [Repost] Link error?

2013-12-16 Thread Mike Parker

On 12/16/2013 9:07 PM, Jack wrote:

Apparently I can't run link.exe.
I've set up the paths as intended.
Here:
C:\D\dm\bin;
C:\D\dmd2\windows\bin;
I've been trying to build gtkd with -m64 and this happens.
On Win7 64 bit.
Help?


When compiling 64-bit with DMD, you need the Visual Studio toolchain 
installed and properly configured. See the wiki[1] for help.


[1] 
http://wiki.dlang.org/Installing_DMD_on_64-bit_Windows_7_(COFF-compatible)


Re: [Repost] Link error?

2013-12-16 Thread Jack

On Monday, 16 December 2013 at 12:33:14 UTC, Mike Parker wrote:

On 12/16/2013 9:07 PM, Jack wrote:

Apparently I can't run link.exe.
I've set up the paths as intended.
Here:
C:\D\dm\bin;
C:\D\dmd2\windows\bin;
I've been trying to build gtkd with -m64 and this happens.
On Win7 64 bit.
Help?


When compiling 64-bit with DMD, you need the Visual Studio 
toolchain installed and properly configured. See the wiki[1] 
for help.


[1] 
http://wiki.dlang.org/Installing_DMD_on_64-bit_Windows_7_(COFF-compatible)


Thank you for your help then.


Re: how to detect OS architecture?

2013-12-16 Thread Hugo Florentino

On Mon, 16 Dec 2013 12:59:52 +0100, John Colvin wrote:

On Monday, 16 December 2013 at 11:56:07 UTC, Hugo Florentino wrote:

On Mon, 16 Dec 2013 12:40:17 +0100, MrSmith wrote:

I think this is what he want
http://dlang.org/phobos/core_cpuid.html#.isX86_64


Thanks, that's precisely what I needed :)


Are you sure?

This will tell you about the processor, but not necessarily about
what the OS supports. I don't know, but you may find that when using
windows 32bit on an x64 machine, cpuid will tell you the cpu is 
64bit,

but the OS won't let you run any 64bit code.


You are right. I realized that this function was not quite what I 
needed when running this code on a 32 bit system:


import std.stdio, core.cpuid;

int main() {
  immutable auto appname = myapp;
  auto appversion = !isX86_64() ? appname ~ 32 : appname ~ 64) ~ 
.exe;

  scope(failure) return -1;
  writeln(appversion);
  return 0;
}

I was expecting myapp32.exe but got myapp64.exe. Apparently what 
isX86_64() detects is the capability of the processor, not the 
arquitecture of the OS.


So currently D has no specific function for detecting the OS 
architecture at runtime? I had not expected this.


I will try using the other options though. Thanks


Re: How to link to libdl under linux

2013-12-16 Thread Marco Leise
Am Mon, 16 Dec 2013 11:09:52 +0100
schrieb MrSmith mrsmit...@yandex.ru:

  You're still not linking ld properly. It would help 
  tremendously if you could show the command line you're using. 
  Otherwise all people can do is make guesses about what *might* 
  be wrong.
 
 Oh, right.
 Here is first with /usr/lib32/libdl.a -L-ldl
 
 andrey@andress-ubuntu:~/anchovy$ dmd -debug -gc -m32 
 examples/fpshelper.d examples/main.d -Iimport -Ideps/dlib 
 -Ideps/derelict-fi-master/source 
 -Ideps/derelict-sdl2-master/source 
 -Ideps/derelict-ft-master/source 
 -Ideps/derelict-gl3-master/source 
 -Ideps/derelict-glfw3-master/source 
 -Ideps/derelict-util-1.0.0/source lib/debug/libgui.a 
 lib/debug/libgraphics.a lib/debug/libcore.a 
 lib/debug/libutils.a deps/dlib/libdlib.a 
 deps/derelict-fi-master/lib/libDerelictFI.a 
 deps/derelict-ft-master/lib/libDerelictFT.a 
 deps/derelict-gl3-master/lib/libDerelictGL3.a 
 deps/derelict-glfw3-master/lib/libDerelictGLFW3.a 
 deps/derelict-util-1.0.0/lib/libDerelictUtil.a 
 /usr/lib32/libdl.a -L-ldl -ofbin/guidemo
 
 deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_416_4ee.o): 
 In function `_D8derelict4util9sharedlib13LoadSharedLibFAyaZPv':
 /home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:60:
  
 warning: Using 'dlopen' in statically linked applications 
 requires at runtime the shared libraries from the glibc version 
 used for linking
 /usr/lib32/libdl.a(dlopen.o): In function `dlopen':
 (.text+0x1b): undefined reference to `__dlopen'
 /usr/lib32/libdl.a(dlclose.o): In function `dlclose':
 (.text+0x1): undefined reference to `__dlclose'
 /usr/lib32/libdl.a(dlsym.o): In function `dlsym':
 (.text+0x1b): undefined reference to `__dlsym'
 /usr/lib32/libdl.a(dlerror.o): In function `dlerror':
 (.text+0x1): undefined reference to `__dlerror'
 collect2: error: ld returned 1 exit status
 --- errorlevel 1
 
 Second with -L-ldl only
 
 andrey@andress-ubuntu:~/anchovy$ dmd -debug -gc -m32 
 examples/fpshelper.d examples/main.d -Iimport -Ideps/dlib 
 -Ideps/derelict-fi-master/source 
 -Ideps/derelict-sdl2-master/source 
 -Ideps/derelict-ft-master/source 
 -Ideps/derelict-gl3-master/source 
 -Ideps/derelict-glfw3-master/source 
 -Ideps/derelict-util-1.0.0/source lib/debug/libgui.a 
 lib/debug/libgraphics.a lib/debug/libcore.a 
 lib/debug/libutils.a deps/dlib/libdlib.a 
 deps/derelict-fi-master/lib/libDerelictFI.a 
 deps/derelict-ft-master/lib/libDerelictFT.a 
 deps/derelict-gl3-master/lib/libDerelictGL3.a 
 deps/derelict-glfw3-master/lib/libDerelictGLFW3.a 
 deps/derelict-util-1.0.0/lib/libDerelictUtil.a -L-ldl 
 -ofbin/guidemo
 
 deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_416_4ee.o): 
 In function `_D8derelict4util9sharedlib13LoadSharedLibFAyaZPv':
 /home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:60:
  
 undefined reference to `dlopen'
 deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_417_5d1.o): 
 In function `_D8derelict4util9sharedlib15UnloadSharedLibFPvZv':
 /home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:64:
  
 undefined reference to `dlclose'
 deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_418_396.o): 
 In function `_D8derelict4util9sharedlib9GetSymbolFPvAyaZPv':
 /home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:68:
  
 undefined reference to `dlsym'
 deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_419_463.o): 
 In function `_D8derelict4util9sharedlib11GetErrorStrFZAya':
 /home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:72:
  
 undefined reference to `dlerror'
 collect2: error: ld returned 1 exit status
 --- errorlevel 1

Do you have the 32-bit version of libdl installed?
What does this command output?:

  find /lib /lib32 /usr/lib /usr/lib32 -name libdl*.so*
  -type f -exec file {} ;

For me it prints

 /lib32/libdl-2.15.so: ELF 32-bit LSB shared object, Intel 80386, version 1 
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

so there is a libdl for 32-bit in /lib32.
If you have one as well, you'll probably need to call the
linker with the verbose option:

dmd -debug -gc -m32 
 examples/fpshelper.d examples/main.d -Iimport -Ideps/dlib 
 -Ideps/derelict-fi-master/source 
 -Ideps/derelict-sdl2-master/source 
 -Ideps/derelict-ft-master/source 
 -Ideps/derelict-gl3-master/source 
 -Ideps/derelict-glfw3-master/source 
 -Ideps/derelict-util-1.0.0/source lib/debug/libgui.a 
 lib/debug/libgraphics.a lib/debug/libcore.a 
 lib/debug/libutils.a deps/dlib/libdlib.a 
 deps/derelict-fi-master/lib/libDerelictFI.a 
 deps/derelict-ft-master/lib/libDerelictFT.a 
 deps/derelict-gl3-master/lib/libDerelictGL3.a 
 deps/derelict-glfw3-master/lib/libDerelictGLFW3.a 
 

Re: how to detect OS architecture?

2013-12-16 Thread Marco Leise
Am Mon, 16 Dec 2013 12:59:52 +0100
schrieb John Colvin john.loughran.col...@gmail.com:

 On Monday, 16 December 2013 at 11:56:07 UTC, Hugo Florentino 
 wrote:
  On Mon, 16 Dec 2013 12:40:17 +0100, MrSmith wrote:
  version(Windows) {
   // Windows code goes here
  } else {
  // Other OS code goes here
  }
 
  More here: http://dlang.org/version.html
 
  I think he wants determine at runtime what architecture x86 or 
  x64
  processor supprots and launch appropriate executable.
 
  I think this is what he want
  http://dlang.org/phobos/core_cpuid.html#.isX86_64
 
  Thanks, that's precisely what I needed :)
 
 Are you sure?
 
 This will tell you about the processor, but not necessarily about 
 what the OS supports. I don't know, but you may find that when 
 using windows 32bit on an x64 machine, cpuid will tell you the 
 cpu is 64bit, but the OS won't let you run any 64bit code.

...and your launcher would in turn fail to work on my Vista
Home Premium 32-bit, which came pre-installed on a 64-bit
system.

-- 
Marco



Re: how to detect OS architecture?

2013-12-16 Thread Marco Leise
Am Mon, 16 Dec 2013 08:19:40 -0500
schrieb Hugo Florentino h...@acdam.cu:

 So currently D has no specific function for detecting the OS 
 architecture at runtime? I had not expected this.

You are the first to raise this question. I guess most of us
just install either a 32-bit version or a 64-bit version and
never found a need to ask from inside the running program if
it is actually the correct architecture. Your launcher
use-case stands out.

But there is really more to it than 32 or 64. There is also
x32, which is a mix of 32-bit pointers with 64-bit CPU
features, giving the best overall performance. Also, while dmd
only emits x86 code, the language and the standard library
strive to be architecture independent except for some minimal
requirements for data types or thread local storage.

And a function like that should probably return an array of
supported ABIs, like [amd64, x32, x86] with the main or
most feature rich architecture in index 0. Just my 2¢

-- 
Marco



Re: how to detect OS architecture?

2013-12-16 Thread Jacob Carlborg

On 2013-12-16 11:53, Hugo Florentino wrote:

Hi,

I am writing a launcher to make a Windows application portable, but
since this application supports both x86 and x86_64, I would like to
detect the architecture of the OS my launcher is being run on, in order
to launch the proper executable.


The easiest would be: if you launcher is built for 64bit, pick the 64bit 
application, otherwise pick the 32bit application.


--
/Jacob Carlborg


Re: how to detect OS architecture?

2013-12-16 Thread Gary Willoughby
On Monday, 16 December 2013 at 13:19:52 UTC, Hugo Florentino 
wrote:

On Mon, 16 Dec 2013 12:59:52 +0100, John Colvin wrote:
On Monday, 16 December 2013 at 11:56:07 UTC, Hugo Florentino 
wrote:

On Mon, 16 Dec 2013 12:40:17 +0100, MrSmith wrote:

I think this is what he want
http://dlang.org/phobos/core_cpuid.html#.isX86_64


Thanks, that's precisely what I needed :)


Are you sure?

This will tell you about the processor, but not necessarily 
about
what the OS supports. I don't know, but you may find that when 
using
windows 32bit on an x64 machine, cpuid will tell you the cpu 
is 64bit,

but the OS won't let you run any 64bit code.


You are right. I realized that this function was not quite what 
I needed when running this code on a 32 bit system:


import std.stdio, core.cpuid;

int main() {
  immutable auto appname = myapp;
  auto appversion = !isX86_64() ? appname ~ 32 : appname ~ 
64) ~ .exe;

  scope(failure) return -1;
  writeln(appversion);
  return 0;
}

I was expecting myapp32.exe but got myapp64.exe. Apparently 
what isX86_64() detects is the capability of the processor, not 
the arquitecture of the OS.


So currently D has no specific function for detecting the OS 
architecture at runtime? I had not expected this.


I will try using the other options though. Thanks


Try building the launcher as a 32bit executable then use the 
following code:


import std.stdio;
import core.sys.windows.windows;

enum AMD64   = 9;
enum IA64= 6;
enum X86 = 0;
enum UNKNOWN = 0x;

void main()
{
SYSTEM_INFO executableEnvironment;
SYSTEM_INFO outerEnvironment;

GetSystemInfo(executableEnvironment);
GetNativeSystemInfo(outerEnvironment);

// See the above enums for values.
	writefln(Executable: %s, 
executableEnvironment.wProcessorArchitecture);

writefln(Outer: %s, outerEnvironment.wProcessorArchitecture);
}

If the launcher is running under Wow64 (the 32bit emulation layer 
on a 64bit processor) the results will be different for 
executableEnvironment and outerEnvironment. GetSystemInfo gets 
the environment the executable is running under, 
GetNativeSystemInfo gets the 'real' environment. I guess it's a 
place to start?


Re: Chaining std.algorithm

2013-12-16 Thread monarch_dodra

On Monday, 16 December 2013 at 04:45:40 UTC, John Carter wrote:
When I try use find in map!find! dmd whinges like crazy at 
me.


First of all, you'd need to use:
map!`find!`
, since you are nesting strings. As you wrote it, it looks like:

map!find! ~ 

See the difference ?

Second, unfortunately, find!pred is not a standalone template. 
The signature is:

find(pred, Range, Args...)
If you write just find!pred dmd doesn't find your match. This 
is, IMO, a limitation and I am currently working on improving the 
situation.


To work around this, you need to make a full call. Use the 
lambda syntax, as suggested by H.S. Teoh.


Re: tango -D2 regex

2013-12-16 Thread JR

On Monday, 16 December 2013 at 07:46:30 UTC, seany wrote:

I dont find any info on backtrack on tango-D2 regex.

For example, I want to match things like

barFOObar

or

bazFOObaz

so I would use, in PCRE, ^(\w*)FOO($1)$, with $1 meaning the 
word (given by \w*  that was matced in the first subpattern 
(\w*)


How to do the samein Tango for D2 (or even phobos for D2)?


Something like http://dpaste.dzfl.pl/0e02c3d1 ? Phobos though.



Re: how to detect OS architecture?

2013-12-16 Thread Marco Leise
Am Mon, 16 Dec 2013 16:04:07 +0100
schrieb Jacob Carlborg d...@me.com:

 On 2013-12-16 11:53, Hugo Florentino wrote:
  Hi,
 
  I am writing a launcher to make a Windows application portable, but
  since this application supports both x86 and x86_64, I would like to
  detect the architecture of the OS my launcher is being run on, in order
  to launch the proper executable.
 
 The easiest would be: if you launcher is built for 64bit, pick the 64bit 
 application, otherwise pick the 32bit application.
 
Hehe, I guess the whole purpose of the launcher is to run in
32-bit and detect at runtime if the 64-bit main executable can
be run or the 32-bit version must be used.

-- 
Marco



Re: how to detect OS architecture?

2013-12-16 Thread Regan Heath

On Mon, 16 Dec 2013 10:53:45 -, Hugo Florentino h...@acdam.cu wrote:
I am writing a launcher to make a Windows application portable, but  
since this application supports both x86 and x86_64, I would like to  
detect the architecture of the OS my launcher is being run on, in order  
to launch the proper executable.


How can I do this?


Compile the launcher as 32bit, and use this global boolean isWow64:

import std.stdio;
import std.internal.windows.advapi32;

void main(string[] args)
{
  writefln(isWow64 ? yes : no);
}

You can thank Kenji for this one :)  Someone document this somewhere  
please :p


The code from advapi32 for those interested..

immutable bool isWow64;

shared static this()
{
// WOW64 is the x86 emulator that allows 32-bit Windows-based  
applications to run seamlessly on 64-bit Windows
// IsWow64Process Function - Minimum supported client - Windows Vista,  
Windows XP with SP2

alias extern(Windows) BOOL function(HANDLE, PBOOL) fptr_t;
auto hKernel = GetModuleHandleA(kernel32);
auto IsWow64Process = cast(fptr_t) GetProcAddress(hKernel,  
IsWow64Process);

BOOL bIsWow64;
isWow64 = IsWow64Process  IsWow64Process(GetCurrentProcess(),  
bIsWow64)  bIsWow64;

}

Basically, your 32 bit launcher process has to, at runtime, ask Kernel32  
for a function IsWow64Process which only exists on 64 bit windows.  So,  
if it doesn't find it, it's 32 bit.  If it finds it, it calls it with the  
current PID to find out of the current process is a 32 bit app running  
inside WOW64 (the emulator layer) and that gives you the answer.


R


--
Using Opera's revolutionary email client: http://www.opera.com/mail/


Re: tango -D2 regex

2013-12-16 Thread Dmitry Olshansky

16-Dec-2013 11:46, seany пишет:

I dont find any info on backtrack on tango-D2 regex.

For example, I want to match things like

barFOObar

or

bazFOObaz

so I would use, in PCRE, ^(\w*)FOO($1)$, with $1 meaning the word (given
by \w*  that was matced in the first subpattern (\w*)


With std.regex of Phobos this should just work.

auto re = regex(`^(\w*)FOO\1$`);

assert(barFOObar.match(re));

Syntax is like in JavaScript or Perl.



How to do the samein Tango for D2 (or even phobos for D2)?



--
Dmitry Olshansky


Re: tango -D2 regex

2013-12-16 Thread Dmitry Olshansky

16-Dec-2013 12:06, seany пишет:

On Monday, 16 December 2013 at 07:56:53 UTC, evilrat wrote:



have you tried look the docs first?

phobos regex patterns described here
http://dlang.org/phobos/std_regex.html


The only mention of backtrack is : bmatch
it returns a regex object with a machine state, and last match, but it
is still not telling me how to actually do a backtrack match.


Docs don't state anything like that. It finds _first_ match and returns 
full state so that you may continue matching or just look at the current 
match.


Backtracking is purely irrelevant technical detail.


I.e. if i
know the machine state and a match (in my example, does that mean that
foo is returned as a match or does it mean thatbaz /bar is returned as a
match, and the next attempt will match the bar/baz - if not, then what
is the call sequence? bmatch (match bar/baz) then match FOO, then again
try to match what bmatch returned?)


Simply put match/bmatch will return a range of matches as they are found 
in the input. Each match is, in turn, a random access range that 
contains full match, followed by each sub-match in the pattern.


--
Dmitry Olshansky


Re: tango -D2 regex

2013-12-16 Thread John Colvin

On Monday, 16 December 2013 at 07:46:30 UTC, seany wrote:

I dont find any info on backtrack on tango-D2 regex.

For example, I want to match things like

barFOObar

or

bazFOObaz

so I would use, in PCRE, ^(\w*)FOO($1)$, with $1 meaning the 
word (given by \w*  that was matced in the first subpattern 
(\w*)


How to do the samein Tango for D2 (or even phobos for D2)?


FYI if you know your regex at compile-time, the ctRegex in phobos 
is *very* fast.


Embed Windows Internet Explorer

2013-12-16 Thread Andre

Hi,

I try to embed Windows Internet Explorer into my application.
Most of the coding should be availabe. During method navigate2
I get an empty white screen. No errors is thrown but also the
web page is not loaded. Do you have some ideas?

= Is use the windows headers from DSource and the dgui forms library.
I attached the source code.

Kind regards
André
module main;

import dgui.all;
import webbrowser;
import win32.ole2;

import std.stdio;

class MainForm: Form
{
private Webbrowser w;

public this()
{
this.text = DGui Form;
this.handleCreated.attach(this.onHandleCreated);
this.size = Size(500, 400);
this.startPosition = FormStartPosition.CENTER_SCREEN;
}

private void onHandleCreated(Control sender, EventArgs e){
HRESULT hr = win32.objbase.CoInitialize(null);  
w = new Webbrowser(this.handle);
int h = createBrowserObject(w);
hr = navigate( w, http://www.google.de; );
//win32.ole2.OleUninitialize();
//win32.objbase.CoUninitialize();
this.resize.attach(this.onResize);
}

private void onResize(Control sender, EventArgs e){
w.setBrowserSize(this.width, this.height);
}
}

int main()
{
return Application.run(new MainForm());
}
module webbrowser;

import core.atomic;

import std.stdio;

private import win32.objfwd: LPMONIKER, IStream, IEnumSTATSTG;

private import win32.oleidl: 
LPCRECT,
LPOLECONTAINER,
LPOLEINPLACEFRAMEINFO,
LPCBORDERWIDTHS,
LPOLEINPLACEACTIVEOBJECT,
LPOLEMENUGROUPWIDTHS,
HOLEMENU,
IOleInPlaceFrame,
IOleInPlaceUIWindow,
IOleInPlaceActiveObject,
IOleInPlaceObject,
IOleClientSite,
IOleWindow,
IOleInPlaceSite,
IDropTarget,
IDataObject,
IOleContainer,
IOleObject;

private import win32.unknwn: IUnknown;
private import win32.basetyps: GUID, IID, CLSID, REFIID, REFCLSID;
private import win32.docobj: IOleCommandTarget;
private import win32.oaidl: IDispatch;
private import win32.wtypes: LPOLESTR, OLECHAR, LPCOLESTR;
private import win32.uuid;
private import win32.winerror;
private import win32.windef: SIZE, HRESULT, DWORD, BOOL, ULONG, POINT, LONG, 
LPRECT, HWND, HMENU, WORD, FALSE,TRUE, RECT;
private import win32.winuser: LPMSG, GetClientRect;
private import win32.objidl:IStorage, SNB, STATSTG;
private import win32.winbase:FILETIME;
private import win32.exdisp: IWebBrowser2;
private import win32.ole2: OleCreate, OleSetContainedObject, OLEIVERB_SHOW;
private import win32.winnt: LPCWSTR, PVOID;
private import win32.oaidl:VARIANT;
private import win32.oleauto:VariantInit, VariantClear, SysAllocString;
private import win32.wtypes: VARENUM, VARTYPE;

interface IDocHostUIHandler : IUnknown {
HRESULT ShowContextMenu(DWORD, POINT* , IUnknown, IDispatch);
HRESULT GetHostInfo( DOCHOSTUIINFO * pInfo );
HRESULT ShowUI(DWORD, IOleInPlaceActiveObject, IOleCommandTarget, 
IOleInPlaceFrame, IOleInPlaceUIWindow);
HRESULT HideUI();
HRESULT UpdateUI();
HRESULT EnableModeless(BOOL);
HRESULT OnDocWindowActivate(BOOL);
HRESULT OnFrameWindowActivate(BOOL);
HRESULT ResizeBorder(LPCRECT, IOleInPlaceUIWindow , BOOL);
HRESULT TranslateAccelerator(LPMSG, GUID* , DWORD);
HRESULT GetOptionKeyPath(LPOLESTR*, DWORD);
HRESULT GetDropTarget(IDropTarget, IDropTarget*);
HRESULT GetExternal(IDispatch*);
HRESULT TranslateUrl(DWORD, OLECHAR*, OLECHAR**);
HRESULT FilterDataObject(IDataObject, IDataObject*);
}

enum tagDOCHOSTUIFLAG {
DIALOG = 0x0001,
DISABLE_HELP_MENU = 0x0002,
NO3DBORDER = 0x0004,
SCROLL_NO = 0x0008,
DISABLE_SCRIPT_INACTIVE = 0x0010,
OPENNEWWIN = 0x0020,
DISABLE_OFFSCREEN = 0x0040,
FLAT_SCROLLBAR = 0x0080,
DIV_BLOCKDEFAULT = 0x0100,
ACTIVATE_CLIENTHIT_ONLY = 0x0200,
OVERRIDEBEHAVIORFACTORY = 0x0400,
CODEPAGELINKEDFONTS = 0x0800,
URL_ENCODING_DISABLE_UTF8 = 0x1000,
URL_ENCODING_ENABLE_UTF8 = 0x2000,
ENABLE_FORMS_AUTOCOMPLETE = 0x4000,
ENABLE_INPLACE_NAVIGATION = 0x0001,
IME_ENABLE_RECONVERSION = 0x0002,
THEME = 0x0004,
NOTHEME = 0x0008,
NOPICS = 0x0010,
NO3DOUTERBORDER = 0x0020,
DISABLE_EDIT_NS_FIXUP = 0x0040,
LOCAL_MACHINE_ACCESS_CHECK = 0x0080,
DISABLE_UNTRUSTEDPROTOCOL = 0x0100,
HOST_NAVIGATES = 0x0200,
ENABLE_REDIRECT_NOTIFICATION = 0x0400,
USE_WINDOWLESS_SELECTCONTROL = 0x0800,
USE_WINDOWED_SELECTCONTROL = 0x1000,
ENABLE_ACTIVEX_INACTIVATE_MODE = 0x2000,
   

Re: how to detect OS architecture?

2013-12-16 Thread Jacob Carlborg

On 2013-12-16 17:46, Marco Leise wrote:


Hehe, I guess the whole purpose of the launcher is to run in
32-bit and detect at runtime if the 64-bit main executable can
be run or the 32-bit version must be used.


The only advantage of that is that only a 32bit launcher needs to be 
distributed. Perhaps that's the whole idea.


--
/Jacob Carlborg


Re: migrating to 64 bit

2013-12-16 Thread Stephen Jones
Thanks for your answers but I wasn't quite clear about what I 
asking. Basically I am on a 64 bit os but I want to continue 
compiling for a 32 bit os. I don't want to reconfigure Derelict 
because I already have all the functionality I need from 
Derelict. Until dmd on Windows 64 bit is sorted out, including a 
clear procedure for setting up the linker I have no need or wish 
to compile for 64 bit. Especially since any d program that 
compiles on 32 bit will compile under 64 bit.


Is there a flag on dmd that forces it to assume it is creating 32 
bit object files? Or is this not possible?


Re: how to detect OS architecture?

2013-12-16 Thread Hugo Florentino

On Mon, 16 Dec 2013 20:23:00 +0100, Jacob Carlborg wrote:

On 2013-12-16 17:46, Marco Leise wrote:


Hehe, I guess the whole purpose of the launcher is to run in
32-bit and detect at runtime if the 64-bit main executable can
be run or the 32-bit version must be used.


The only advantage of that is that only a 32bit launcher needs to be
distributed. Perhaps that's the whole idea.


It is. :)


Shouldn't SList in std.container hold an owner pointer to verify a range belongs to the list?

2013-12-16 Thread Andrej Mitrovic
Here's some improper code that is not checked properly by SList
(meaning no assertions, not even in debug mode):

-
import std.stdio;
import std.container;

void main()
{
auto s1 = SList!string([a, b, d]);
auto s2 = SList!string([a, b, d]);

// note the s1[] instead of s2[]!
s2.insertAfter(std.range.take(s1[], 2), c);

writeln(s1[]);  // updated s1, not s2!
writeln(s2[]);  // s2 stays the same.
}
-

Note the docs of insertAfter:

Inserts $(D stuff) after range $(D r), which must be a range
previously extracted from this container.

Well clearly we have a range extracted from one list being used to add
items to a different list, but SList makes no checks at all to verify
the range belongs to it. I had a look at DCollections[1], and it
stores an owner pointer (or reference) in the range type when its
extracted from a linked-list, so it can do these types of sanity
checks.

So shouldn't we add this to SList? We'd have to add an owner field to
its internal Range struct.

[1] : https://github.com/schveiguy/dcollections


Re: how to detect OS architecture?

2013-12-16 Thread Hugo Florentino

On Mon, 16 Dec 2013 17:04:18 -, Regan Heath wrote:

...
Compile the launcher as 32bit, and use this global boolean isWow64:
...


Thanks, it's nice to have another option.
What do you guys think are the possible advantages/disadvantages of 
either solution?




package.d

2013-12-16 Thread Leandro Motta Barros
Hello,

I have some code using the old all.d idiom, which I am changing to use
the new package.d feature.

Originally, I had something like this:

// mylib/util.d:
module mylib.util;
class Foo { }

// mylib/all.d:
module mylib.all;
public import mylib.util;

// main.d:
import mylib.all;
void main()
{
   auto f = new mylib.util.Foo;
}

And this used to work. Now, I added a new file:

// package.d
module mylib;
public import mylib.util;

And changed the 'import' in the main one:

// main.d
import mylib;

void main()
{
   auto f = new mylib.util.Foo;
}

Now, the compiler complains:

main.d(5): Error: undefined identifier 'util'
main.d(5): Error: mylib.util.Foo is used as a type

Isn't this 'package.d' feature supposed to work just as the old 'all.d' and
'_,d' we used before?

(I see that I can use 'mylib.Foo' instead of 'mylib.util.Foo', but
http://dlang.org/module.html is clear saying that [a]ll symbols from a
publicly imported module are also aliased in the importing module. This
means that if module D imports module C, and module C *publicly* imports
module B which has the symbol *bar*, in module D you can access the symbol
via bar, B.bar, and C.bar.)

I am using DMD 2.064 here.

Thanks,

LMB


Re: migrating to 64 bit

2013-12-16 Thread Jordi Sayol
El 16/12/13 22:13, Stephen Jones ha escrit:
 Thanks for your answers but I wasn't quite clear about what I asking. 
 Basically I am on a 64 bit os but I want to continue compiling for a 32 bit 
 os. I don't want to reconfigure Derelict because I already have all the 
 functionality I need from Derelict. Until dmd on Windows 64 bit is sorted 
 out, including a clear procedure for setting up the linker I have no need or 
 wish to compile for 64 bit. Especially since any d program that compiles on 
 32 bit will compile under 64 bit.
 
 Is there a flag on dmd that forces it to assume it is creating 32 bit object 
 files? Or is this not possible?
 

AFAIK, 32-bit dmd will always compile to 32-bit by default, so -m32 flag is 
not needed even if compiling on 64-bit windows. To compile to 64-bit use -m64.

-- 
Jordi Sayol


using std.algorithm.topN with std.range.zip fails with undefined swap

2013-12-16 Thread Nikhil Padmanabhan
(apologies in advance if this posts multiple times, I messed up the sending
email address the first time).

Hi,

Trying to compile :

import std.stdio, std.range, std.algorithm;

void main() {
auto a = [2.0,1.0,3.0];
struct Point {
double x;
}
auto b = [Point(4.0), Point(5.0), Point(6.0)];

topN!(a[0]  b[0])(zip(a,b),1);
//sort!(a[0]  b[0])(zip(a,b));

writeln(a,b);
}


std/algorithm.d(8225): Error: template std.algorithm.swap does not match
any function template declaration.

Swapping out topN with sort works just fine. I assume both sort and topN
use swap, is there a reason this doesn't work with topN?

Thanks in advance,

-- Nikhil


-
Nikhil Padmanabhan
nikhil.padmanab...@yale.edu