Who can stop it ? Help me,thank you.

2018-10-17 Thread FrankLike via Digitalmars-d-learn

Hi,teacher:

 I like D lang,when I download the soft from  
http://www.360totalsecurity.com/en/, but I find, the link.exe of 
dmd or ldc2,all have the ‘Trojan horse virus’.


dmd.2.082.1.windows.7z:HEUR/QVM19.1.92C9.Malware.Gen
file MD5:91ce2a59f06151902a1f3fc49e0a4752
ldc2-7e9db717-windows-x64.7z:  HEUR/QVM202.0.92C9.Malware.Gen
file MD5:9535728d583e950ea446599b2018cbbd

It let me not to use them.
What can I do?
Help me.

Thank you.






Re: Who can stop it ? Help me,thank you.

2018-10-17 Thread FrankLike via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 13:50:03 UTC, Stanislav Blinov 
wrote:

On Wednesday, 17 October 2018 at 13:48:04 UTC, FrankLike wrote:


What can I do?


Delete the bloatware that you downloaded.


Where can get the new dmd or ldc2 that's no 'Trojan horse virus' ?


How to ensure string compatibility In D?

2019-01-22 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,
  In C++, _T can guarantee that when converting from ascii 
encoding type to unicode encoding type, the program does not need 
to be modified. What do I need to do in D?


Thanks.


Re: How to ensure string compatibility In D?

2019-01-22 Thread FrankLike via Digitalmars-d-learn

On Tuesday, 22 January 2019 at 14:07:48 UTC, Olivier Pisano wrote:

On Tuesday, 22 January 2019 at 13:55:30 UTC, FrankLike wrote:


In D, there is only Unicode. The language doesn't manipulate 
strings encoded in Windows local code-pages.


For example:

 std::wstring strTest(_T("d://"));
 UINT nRes = ::GetDriveType(strTest.c_str());

It can work in C++.
But:
//here is work 
ok///

import std.stdio;
import std.string;
import std.conv;
import win32.winbase;

void main()
{
string  strA_Z ="CD";
auto type = GetDriveType((to!string(strA_Z[0])~":\\").toStringz);
writeln(to!string(strA_Z[0])~" is ",type);
}
//here is work 
error//


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

void main()
{
string  strA_Z ="CD";
auto type = GetDriveType((to!string(strA_Z[0])~":\\").toStringz);
writeln(to!string(strA_Z[0])~" is ",type);
}


 //---Error Info//
slicea2.d(9): Error: function 
core.sys.windows.winbase.GetDriveTypeW(const(wchar

)*) is not callable using argument types (immutable(char)*)
slicea2.d(9):cannot pass argument toStringz(to(strA_Z[0]) 
~ ":\\") of ty

pe immutable(char)* to parameter const(wchar)*


Some error is "core.sys.windows.windows"?

Thank you.




Re: How to ensure string compatibility In D?

2019-01-22 Thread FrankLike via Digitalmars-d-learn

On Tuesday, 22 January 2019 at 16:13:57 UTC, FrankLike wrote:
On Tuesday, 22 January 2019 at 14:07:48 UTC, Olivier Pisano 
wrote:


Some error is in  "core.sys.windows.windows"?

Thank you.




Re: How to ensure string compatibility In D?

2019-01-22 Thread FrankLike via Digitalmars-d-learn

On Tuesday, 22 January 2019 at 16:18:17 UTC, Adam D. Ruppe wrote:

Use "mystring"w, notice the w after the closing quote.


 "GetDriveType" Function is auto work by "_T" in C++,but how to 
do in D?






Re: How to ensure string compatibility In D?

2019-01-22 Thread FrankLike via Digitalmars-d-learn

On Tuesday, 22 January 2019 at 16:18:17 UTC, Adam D. Ruppe wrote:

Use "mystring"w, notice the w after the closing quote.


Or toStringz is not work like c_str() in C++?


Re: How to ensure string compatibility In D?

2019-01-22 Thread FrankLike via Digitalmars-d-learn

On Tuesday, 22 January 2019 at 21:49:00 UTC, bauss wrote:

On Tuesday, 22 January 2019 at 19:14:43 UTC, Jonathan M Davis



Is there a reason we cannot implement toStringz like:

immutable(TChar)* toStringz(TChar = char)(scope const(TChar)[] 
s) @trusted pure nothrow;

// Couldn't find a way to get the char type of a string, so
"core.sys.windows.windows.winbase",it's implementation is a good 
choice.

couldn't make the following generic:
immutable(char)* toStringz(return scope string s) @trusted pure 
nothrow;
immutable(wchar)* toStringz(return scope wstring s) @trusted 
pure nothrow;
immutable(dchar)* toStringz(return scope dstring s) @trusted 
pure nothrow;



For example:
/START//
import core.sys.windows.windows;
import std.stdio;
import std.string;
import std.conv;

void main()
{
autostrA_Z ="CD"w;
auto type = GetDriveType((to!wstring(strA_Z[0])~":\\"w).tos);
writeln(to!wstring(strA_Z[0])~" is ",type);
}

private auto tos(wstring str)
{
 version (ANSI)
 {
writeln("ANSI");
return cast(const(char)*)(str);
 }
 else
 {
writeln("Unicode");
return cast(const(wchar)*)(str);

 }
}
private auto tos(string str)
{
 version (ANSI)
 {
writeln("ANSI");
return cast(const(char)*)(str);
 }
 else
 {
writeln("Unicode");
return cast(const(wchar)*)(str);
 }
}
/END//

It's work ok.


Re: How to ensure string compatibility In D?

2019-01-22 Thread FrankLike via Digitalmars-d-learn

On Tuesday, 22 January 2019 at 21:49:00 UTC, bauss wrote:

On Tuesday, 22 January 2019 at 19:14:43 UTC, Jonathan M Davis



Is there a reason we cannot implement toStringz like:

immutable(TChar)* toStringz(TChar = char)(scope const(TChar)[] 
s) @trusted pure nothrow;

// Couldn't find a way to get the char type of a string, so



couldn't make the following generic:
immutable(char)* toStringz(return scope string s) @trusted pure 
nothrow;
immutable(wchar)* toStringz(return scope wstring s) @trusted 
pure nothrow;
immutable(dchar)* toStringz(return scope dstring s) @trusted 
pure nothrow;


For example:
///start///
import core.sys.windows.windows;
import std.stdio;
import std.string;
import std.conv;

void main()
{
autostrA_Z ="CD"w;
auto type = GetDriveType(tos(to!wstring(strA_Z[0])~":\\"));
writeln(to!wstring(strA_Z[0])~" is ",type);
}

private auto tos(T)(T str)
{
 version (ANSI)
 {
writeln("ANSI");
return cast(const(char)*)(str);
 }
 else
 {
writeln("Unicode");
return cast(const(wchar)*)(str);

 }
}
///end/
It's work ok.


Re: How to ensure string compatibility In D?

2019-01-23 Thread FrankLike via Digitalmars-d-learn
On Wednesday, 23 January 2019 at 10:44:51 UTC, Jonathan M Davis 
wrote:
On Tuesday, January 22, 2019 2:49:00 PM MST bauss via 
Digitalmars-d-learn wrote:



toUTFz is the generic solution. toStringz exists specifically


Error: template std.utf.toUTFz cannot deduce function from
 argument types !()(string), candidates are:
E:\D\DMD2\WINDOWS\BIN\..\..\src\phobos\std\utf.d(3070):
std.utf.toUTFz(P)


I have solved the problem in this way:

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

void main()
{
autostrA_Z ="CD"w;
auto type = GetDriveType(tos(to!wstring(strA_Z[0])~":\\"));
writeln(to!wstring(strA_Z[0])~" is ",type);
}

private auto tos(T)(T str)
{
 version (ANSI)
 {
writeln("ANSI");
return cast(const(char)*)(str);
 }
 else
 {
writeln("Unicode");
return cast(const(wchar)*)(str);

 }
}

Thanks.


Re: How to ensure string compatibility In D?

2019-01-23 Thread FrankLike via Digitalmars-d-learn
On Wednesday, 23 January 2019 at 14:12:09 UTC, Jonathan M Davis 
wrote:

On Wednesday, January 23, 2019 5:42:55 AM MST FrankLike via


std.conv.to will allow you to convert between string and 
wstring, but for calling C functions, you still need the 
strings to be zero-terminated unless the function specifically 
takes an argument indicating the number of characters in the 
string. Strings in D are not zero-terminated, so std.conv.to is 
not going to produce strings that work with C functions. 
std.conv.to and std.utf.toUTFz solve different problems.


[...]


Thank you.


What is the alternative to the setlocale function of c in D? Thank you.

2019-01-23 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,

for example:

import std.stdio;
import std.process:executeShell;

extern(C) int setlocale(int,char*);

static this()
{
import core.stdc.wchar_;
import core.stdc.stdio;
fwide(core.stdc.stdio.stdout,1);
setlocale(0,cast(char*)"china");
}

void main()
{
writeln("字符");
executeShell("pause");
}
///code end/
In D2.078.1 It works very ok.
But After D2.080 ,It not works.
Who can help me?
Thank you.


Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-24 Thread FrankLike via Digitalmars-d-learn

On Thursday, 24 January 2019 at 07:48:44 UTC, FrankLike wrote:

Hi,everyone,

for example:

import std.stdio;
import std.process:executeShell;

extern(C) int setlocale(int,char*);

static this()
{
import core.stdc.wchar_;
import core.stdc.stdio;
fwide(core.stdc.stdio.stdout,1);
setlocale(0,cast(char*)"china");
}

void main()
{
writeln("字符");
executeShell("pause");
}
///code end/

In D2.078.1 It can display Chinese characters correctly!
But After D2.080 , but it can't be used now.
Who can help me?
Thank you.




Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-24 Thread FrankLike via Digitalmars-d-learn

On Thursday, 24 January 2019 at 12:19:44 UTC, Kagamin wrote:

Try workarounds here:
https://issues.dlang.org/show_bug.cgi?id=1448
https://issues.dlang.org/show_bug.cgi?id=2742


Ok,thank you.

import std.stdio;
import core.sys.windows.windows;
import std.process:executeShell;
extern(Windows) bool SetConsoleOutputCP(uint);

void main()
{
SetConsoleOutputCP(65001);
writeln("字符");
executeShell("pause");
}



Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-24 Thread FrankLike via Digitalmars-d-learn

On Thursday, 24 January 2019 at 12:19:44 UTC, Kagamin wrote:

Try workarounds here:
https://issues.dlang.org/show_bug.cgi?id=1448
https://issues.dlang.org/show_bug.cgi?id=2742


How do I set the font? Please.


Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-25 Thread FrankLike via Digitalmars-d-learn

On Friday, 25 January 2019 at 08:41:23 UTC, Kagamin wrote:
Create a shortcut to cmd.exe and edit its properties. The 
console window itself has a system menu for this too.


I known that.
I need to set the font by the code now, because I need to do the 
installer, can't let this installer set the properties on each 
computer?


Thank you.


Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-25 Thread FrankLike via Digitalmars-d-learn

On Friday, 25 January 2019 at 16:14:56 UTC, Kagamin wrote:
also 
http://blogs.microsoft.co.il/pavely/2009/07/23/changing-console-fonts/


That's so much code than next code!

/
extern(C) int setlocale(int,char*);

static this()
{
import core.stdc.wchar_;
import core.stdc.stdio;
fwide(core.stdc.stdio.stdout,1);
setlocale(0,cast(char*)"china");
}
/
After D2.078.1,it's not work.
why?
thank you.


Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-25 Thread FrankLike via Digitalmars-d-learn

On Friday, 25 January 2019 at 15:05:50 UTC, John Chapman wrote:

On Friday, 25 January 2019 at 14:23:15 UTC, FrankLike wrote:
I need to set the font by the code now, because I need to do 
the installer, can't let this installer set the properties on 
each computer?


SetCurrentConsoleFontEx perhaps?

https://docs.microsoft.com/en-us/windows/console/setcurrentconsolefontex


That's so much code than next code.

///
extern(C) int setlocale(int,char*);

static this()
{
import core.stdc.wchar_;
import core.stdc.stdio;
fwide(core.stdc.stdio.stdout,1);
setlocale(0,cast(char*)"china");
}
///
But After D2.078.1,it's not work.
Why?
Thank you.


Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-26 Thread FrankLike via Digitalmars-d-learn

On Saturday, 26 January 2019 at 09:33:33 UTC, John Chapman wrote:

What has that code got to do with setting the console's font? 
So you need to add more code to accomplish that.


You don't need to set the font to achieve the goal, why not?


Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-27 Thread FrankLike via Digitalmars-d-learn

On Sunday, 27 January 2019 at 10:44:04 UTC, John Chapman wrote:

On Sunday, 27 January 2019 at 06:14:15 UTC, FrankLike wrote:
On Saturday, 26 January 2019 at 09:33:33 UTC, John Chapman 
wrote:




What has that code got to do with setting the console's font? 
So you need to add more code to accomplish that.


You don't need to set the font to achieve the goal, why not?


This should work:

const(char)[] toCodePage(const(char)[] s, uint codePage = 0) {
  import core.sys.windows.winnls, std.utf;

  foreach (char c; s) {
if (c >= 0x80) {
  auto temp = s.toUTF16z();
  char[] result;
  if ((result.length = WideCharToMultiByte(codePage, 0, 
temp, -1, null, 0, null, null)) != 0)
WideCharToMultiByte(codePage, 0, temp, -1, result.ptr, 
cast(int)result.length, null, null);

  return result;
}
  }
  return s;
}

void main() {
  import core.sys.windows.wincon, std.stdio;

  SetConsoleOutputCP(936); // Simplified Chinese codepage
  writeln("字符".toCodePage(936));
}

Yes.

extern(C) int setlocale(int,char*);

static this()
{
import core.stdc.wchar_;
import core.stdc.stdio;
fwide(core.stdc.stdio.stdout,1);
setlocale(0,cast(char*)"china");
}
///
it's simple than yours,and don't need convert every string,why 
not work after D2.0.78.1?




Re: How can I express the type of a function in D?

2019-01-29 Thread FrankLike via Digitalmars-d-learn

On Wednesday, 30 January 2019 at 05:14:20 UTC, Sobaya wrote:
I want to get a mangled name of a D function by 
`core.demangle.mangle`, but I'm in trouble because there are no 
ways to express a type of a function, which is used for a 
template argument of `mangle`.


For example, it is wrong to use the type `int 
function(int,int)` to express the type of `int add(int,int)`.
Because it expresses the type of a function POINTER, not just a 
function.


The fuction name in a binary compiled this function is 
"_D3addFiiZi", but `mangle!(int function(int,int))("add")` 
returns "_D3addPFiiZi", which includes "P" meaning POINTER.


How can I get the former one?

Thanks.


import std.stdio;
alias int*  PINT;

void main()
{
auto x= Add(1,2);
writeln(x);
writeln(&x);
executeShell("pause");
}

private PINT Add(int a,int b)
{
return cast(PINT)(a+b);
}

CODE END//
It works ok.


Re: How can I express the type of a function in D?

2019-01-29 Thread FrankLike via Digitalmars-d-learn

On Wednesday, 30 January 2019 at 05:40:50 UTC, FrankLike wrote:

On Wednesday, 30 January 2019 at 05:14:20 UTC, Sobaya wrote:
I want to get a mangled name of a D function by 
`core.demangle.mangle`, but I'm in trouble because there are 
no ways to express a type of a function, which is used for a 
template argument of `mangle`.


For example, it is wrong to use the type `int 
function(int,int)` to express the type of `int add(int,int)`.
Because it expresses the type of a function POINTER, not just 
a function.


The fuction name in a binary compiled this function is 
"_D3addFiiZi", but `mangle!(int function(int,int))("add")` 
returns "_D3addPFiiZi", which includes "P" meaning POINTER.


How can I get the former one?

Thanks.


import std.stdio;
import std.process:executeShell;
import core.demangle;

void main()
{   
assert(mangle!(int function(int))("a.b") == "_D1a1bPFiZi");
executeShell("pause");
}

CODE END//
Yes,"_D1a1bPFiZi",which includes "P".





How to test that the IP port is reachable?

2019-04-05 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,

How to test that the IP port is reachable?

In C,you can do this like that, what should I do in D?

/* C Code*/
https://blog.csdn.net/zhangyingchuang/article/details/51957552

#include 
#include 
#include 
#include 
#include     /* inet(3) functions */

#define bool int
#define false 0
#define true 1

bool checkIPandPort(const char* ip, const char* port) {
    struct sockaddr_in addr;
    int fd = socket(AF_INET, SOCK_STREAM, 0);

    memset(&addr, 0, sizeof(addr));
    addr.sin_family = AF_INET;
    addr.sin_port = htons(atoi(port));
    addr.sin_addr.s_addr = inet_addr(ip);

    if (connect(fd, (struct sockaddr *) &addr, sizeof(struct 
sockaddr)) < 0) {

        printf("connect error \n");
        return false;
    }
    return true;
}
--
But how to do it in D?
Thanks.


Re: How to test that the IP port is reachable?

2019-04-05 Thread FrankLike via Digitalmars-d-learn

On Saturday, 6 April 2019 at 03:24:04 UTC, FrankLike wrote:

Hi,everyone,...


Do you have some better code than this?

import std.stdio;
import std.socket;

void main()
{
testIPPort();
}
bool testIPPort()
{
try
{
		auto results = 
getAddressInfo("127.0.0.1",AddressInfoFlags.NUMERICHOST);

auto sock = new Socket(results[0]);
auto address = getAddress("127.0.0.1",8080);
sock.connect(address[0]);
writeln(address," connect ok");
return true;
}
catch(SocketException e)
{   return false;
}
}
---
Thanks.


Is there anyone on the official website who is willing to submit this?

2019-06-04 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,

Is there anyone on the official website who is willing to submit 
this? If you can submit, the development of D language is a good 
thing.


"https://open.soft.360.cn/regist.php";

"link.exe" and "optlink.exe" found the Trojan virus:
-
Type: "Trojan-HEUR/QVM19.1.A5B9.Malware.Gen"
Description: Trojan is a malware disguised as a normal file that 
steals your account, password, and other private information.

Scan Engine: Cloud Feature Engine
File path: "...link.exe"
File size:   (230,472 bytes)
Document fingerprint "(MD5)": "5c092ecec3788eb7f7df2673dcbd6f5c"
Digital Signature: D Language Foundation
Is the digital signature valid: valid
Handling suggestions: quarantine files
--
Does anyone know what is going on?

Is there anyone on the official website who is willing to submit 
this? If you can submit, the development of D language is a good 
thing.

"https://open.soft.360.cn/regist.php";

Thank you.


Re: Write native GUI applications for Windows

2017-12-21 Thread FrankLike via Digitalmars-d-learn

On Monday, 18 December 2017 at 07:55:25 UTC, Andrey wrote:

Hello!
I have a question about creating native GUI applications for 
Windows 7 or/and Windows 10.


Hi,here is a very good native d gui lib,it's name is "dgui":   
https://github.com/FrankLIKE/DguiT/


I fork and modify ,let it work on DMD2.077 for win7 or win10.
It can make the x64 lib.

You can try it.

Injoy it.

Frank.


Where can get the Number Convert module?Thanks.

2018-01-13 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,
I need some help on 'Number Convert module' in D,such as 
byte[] type to  BinaryDigit.

Where can get the module?

Thanks.


Re: Where can get the Number Convert module?Thanks.

2018-01-13 Thread FrankLike via Digitalmars-d-learn
On Sunday, 14 January 2018 at 02:03:39 UTC, Jonathan M Davis 
wrote:



Well, I'm not quite sure what you mean, but if you mean that


Such as byte[] byteData =[0,0,0,8];
to convert, at last,get the string bit :"100".or get the BitArray.

Thanks.




Re: Where can get the Number Convert module?Thanks.

2018-01-13 Thread FrankLike via Digitalmars-d-learn

On Sunday, 14 January 2018 at 02:41:39 UTC, FrankLike wrote:
On Sunday, 14 January 2018 at 02:03:39 UTC, Jonathan M Davis 
wrote:



Well, I'm not quite sure what you mean, but if you mean that

Sorry,Such as byte[] byteData =[8,0,0,0];
to convert, at last,get the string bit :"100".or get the BitArray.

Thanks.




Re: Where can get the Number Convert module?Thanks.

2018-01-13 Thread FrankLike via Digitalmars-d-learn
On Sunday, 14 January 2018 at 03:09:40 UTC, Jonathan M Davis 
wrote:
On Sunday, January 14, 2018 02:41:39 FrankLike via 
Digitalmars-d-learn wrote:

[...]


I'd suggest looking at

[...]


I get the result "1000" from  byte[] byteData =[0,0,0,8];

Thank you very much.


Re: Where can get the Number Convert module?Thanks.

2018-01-13 Thread FrankLike via Digitalmars-d-learn

On Sunday, 14 January 2018 at 03:28:28 UTC, FrankLike wrote:
On Sunday, 14 January 2018 at 03:09:40 UTC, Jonathan M Davis 
wrote:
On Sunday, January 14, 2018 02:41:39 FrankLike via 
Digitalmars-d-learn wrote:

[...]


I'd suggest looking at

[...]



 I get the result "1000" from  ubyte[] byteData =[0,0,0,8];

 Thank you very much.




Re: Where can get the Number Convert module?Thanks.

2018-01-14 Thread FrankLike via Digitalmars-d-learn
On Sunday, 14 January 2018 at 03:49:05 UTC, Jonathan M Davis 
wrote:



I get the result "1000" from  byte[] byteData =[0,0,0,8];

Thank you very much.


Good to hear.

On a side note, I would point out that you almost certainly 
want to be using ubyte and not byte. byte is signed, whereas 
ubyte is unsigned. So, if you want to represent bytes of memory 
rather than an integral value between 1 and 127, then you want 
ubyte.


- Jonathan M Davis


Thank you.


How to convert hex string to string or ubytes? Thanks.

2018-02-04 Thread FrankLike via Digitalmars-d-learn
Now,I can get the string from hex string in compile time,but how 
to get it in run time?


How to get it in run time?

Thanks.


Re: How to convert hex string to string or ubytes? Thanks.

2018-02-04 Thread FrankLike via Digitalmars-d-learn

On Monday, 5 February 2018 at 06:12:22 UTC, H. S. Teoh wrote:

On Mon, Feb 05, 2018 at 05:48:00AM +, FrankLike via



assert(str == "Hello world!");


Thanks.very good!




Re: How to convert hex string to string or ubytes? Thanks.

2018-02-04 Thread FrankLike via Digitalmars-d-learn

On Monday, 5 February 2018 at 06:12:22 UTC, H. S. Teoh wrote:

On Mon, Feb 05, 2018 at 05:48:00AM +, FrankLike via



auto input = "48656c6c6f20776f726c6421";
auto str = input.chunks(2)
.map!(digits => cast(char) digits.to!ubyte(16))
.array;


But,if the input come from here:

import std.digest.md;
auto hash =md5Of("Some Words");
auto input = hexString(hash);
 auto str = input.chunks(2)
 .map!(digits => cast(char) digits.to!ubyte(16))
 .array;

Then get an error:
core.exception.UnicodeException@src\rt\util\utf.d(292):invalid 
UTF-8 sequence

--
0x0041B8E6
0x00419530
0x0040796F

Thanks.



Re: How to convert hex string to string or ubytes? Thanks.

2018-02-05 Thread FrankLike via Digitalmars-d-learn

On Monday, 5 February 2018 at 06:12:22 UTC, H. S. Teoh wrote:

On Mon, Feb 05, 2018 at 05:48:00AM +, FrankLike via



auto input = "48656c6c6f20776f726c6421";
auto str = input.chunks(2)
.map!(digits => cast(char) digits.to!ubyte(16))
.array;


But,if the input come from here:

import std.digest.md;
auto hash =md5Of("Some Words");
auto input = cast(string)hexString(hash);

 auto str = input.chunks(2)
 .map!(digits => cast(char) digits.to!ubyte(16))
 .array;

Then get an error:
core.exception.UnicodeException@src\rt\util\utf.d(292):invalid 
UTF-8 sequence

--
0x0041B8E6
0x00419530
0x0040796F

Thanks.



Re: How to convert hex string to string or ubytes? Thanks.

2018-02-05 Thread FrankLike via Digitalmars-d-learn

On Monday, 5 February 2018 at 09:45:11 UTC, tetyys wrote:

On Monday, 5 February 2018 at 08:41:43 UTC, FrankLike wrote:


Casting unknown bytes to string or char is unsafe, and 
obviously some bytes can be invalid UTF8 sequences.


Thank you.I got my error.




Re: How to convert hex string to string or ubytes? Thanks.

2018-02-05 Thread FrankLike via Digitalmars-d-learn

On Monday, 5 February 2018 at 10:04:10 UTC, Seb wrote:

On Monday, 5 February 2018 at 08:41:43 UTC, FrankLike wrote:



auto input = cast(string)hexString(hash);

Use toHexString to get the string:


Sorry,'hexString(hash)' is my clerical error.

Thank you.I got the answer "no array".





How to use Com object (it comes from other dll) in D? Thanks.

2018-02-22 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,
 I want use the Com object (it comes from other dll) in D,but the 
core.sys.windows.objidl:QueryInterface Fuction not work.

For example:


import core.sys.windows.windef;
import core.sys.windows.basetyps;
import core.sys.windows.uuid;
import core.sys.windows.com;
import 
core.sys.windows.objbase:CoInitialize,CoUninitialize,CoCreateInstance;

import core.sys.windows.objidl;//:QueryInterface
import core.sys.windows.shlobj;//:IShellLink
import core.sys.windows.unknwn;

if(lpszLnkFileDir is null) return;
HRESULT hr;
IShellLink* pLink;
IPersistFile* ppf;

	hr = CoCreateInstance(&CLSID_ShellLink,NULL, 
CLSCTX_INPROC_SERVER,&IID_IShellLinkA,cast(PVOID*)&pLink);//cast(PVOID*)


writeln("CoCreateInstance ");
if(FAILED(hr))
{
writeln("FAILED(hr) ");
return ;
}
writeln("  pLink is "~pLink.to!string);
writeln("will QueryInterface hr is "~hr.to!string);
writeln(IID_IPersistFile.to!string);
	hr = pLink.QueryInterface(&IID_IPersistFile, 
cast(PVOID*)&ppf);// err <-

writeln("pLink.QueryInterface ");

-
It stops in 'hr = pLink.QueryInterface(&IID_IPersistFile, 
cast(PVOID*)&ppf);'

But  the same c++ code is ok.
Who can help me?
Thanks.



Re: How to use Com object (it comes from other dll) in D? Thanks.

2018-02-22 Thread FrankLike via Digitalmars-d-learn
On Thursday, 22 February 2018 at 13:15:11 UTC, rikki cattermole 
wrote:


Reminder classes in D are already references, no need for 
pointers to them.


Thank you,but get the same error.

[D CODE]

if(lpszLnkFileDir is null) return;
HRESULT hr;
IShellLink pLink;
IPersistFile ppf;

	hr = CoCreateInstance(CLSID_ShellLink,NULL, 
CLSCTX_INPROC_SERVER,IID_IShellLinkA,pLink);//cast(PVOID*)


DisplayInfoWork("CoCreateInstance ");
if(FAILED(hr))
{
DisplayInfoWork("FAILED(hr) ");
return ;
}
DisplayInfoWork("  pLink is "~pLink.to!string);
DisplayInfoWork("will QueryInterface hr is "~hr.to!string);
DisplayInfoWork(IID_IPersistFile.to!string);
hr = pLink.QueryInterface(IID_IPersistFile, ppf);// err <-
DisplayInfoWork("pLink.QueryInterface ");

---log info--
CoCreateInstance
  pLink is 5E9954
will QueryInterface hr is 0
const(GUID)(267, 0, 0, [192, 0, 0, 0, 0, 0, 0, 70])
Access Violation

---end
Thanks.


Re: How to use Com object (it comes from other dll) in D? Thanks.

2018-02-22 Thread FrankLike via Digitalmars-d-learn
On Thursday, 22 February 2018 at 13:15:11 UTC, rikki cattermole 
wrote:

On 23/02/2018 2:12 AM, FrankLike wrote:



 IShellLink* pLink;
 IPersistFile* ppf;


Reminder classes in D are already references, no need for 
pointers to them.


Ok,I delete the pointers ,It's ok!

Thank you very much!


How to use strip or stripRight on char[len] ? Thanks.

2018-02-22 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,
How to use strip or stripRight on char[len]?

For example:

string abcs ="aabc";
auto abcsaa = abcs.stripRight;
writeln(abcsaa);
writeln("---abcsaa--stripRight ok ");


 char[100] abc ="aabc";
 auto abcaa = ((abc).dup).stripRight;
 writeln(abcaa);
writeln("stripRight error- ");

Where is error? Thanks.


Re: How to use strip or stripRight on char[len] ? Thanks.

2018-02-22 Thread FrankLike via Digitalmars-d-learn
On Thursday, 22 February 2018 at 16:59:40 UTC, Adam D. Ruppe 
wrote:

On Thursday, 22 February 2018 at 16:55:14 UTC, FrankLike wrote:


It is simply that these functions require a slice so it can 
resize it and you can't resize a static array.


   char[100] abc ="aabc";
   string aa = to!string(abc);
   string aaa = aa.stripRight;


It get the same result.










Re: How to use strip or stripRight on char[len] ? Thanks.

2018-02-22 Thread FrankLike via Digitalmars-d-learn

On Thursday, 22 February 2018 at 17:08:14 UTC, FrankLike wrote:
On Thursday, 22 February 2018 at 16:59:40 UTC, Adam D. Ruppe 
wrote:

On Thursday, 22 February 2018 at 16:55:14 UTC, FrankLike wrote:


It is simply that these functions require a slice so it can 
resize it and you can't resize a static array.



char[100] abc ="aabc";
char[] p = abc;
string aa = to!string(p);
 string aaa = aa.stripRight;


 It get the same result too.




Re: How to use strip or stripRight on char[len] ? Thanks.

2018-02-22 Thread FrankLike via Digitalmars-d-learn
On Thursday, 22 February 2018 at 16:59:40 UTC, Adam D. Ruppe 
wrote:

On Thursday, 22 February 2018 at 16:55:14 UTC, FrankLike wrote:

 char[100] abc ="aabc";
 auto abcaa = ((abc).dup).stripRight;


try:

auto abcaa = stripRight(abc[])


Now,I want to get the result:

 char[100] Path;
 writeln("will get path ");
 SHGetSpecialFolderPath(NULL,cast(char*)Path.ptr,CSIDL_DESKTOP,0);

if use char[] Path;

It not get the result.

How to strip the Path? Thanks.


Re: How to use strip or stripRight on char[len] ? Thanks.

2018-02-22 Thread FrankLike via Digitalmars-d-learn
On Thursday, 22 February 2018 at 18:02:11 UTC, Adam D. Ruppe 
wrote:


You don't strip that at all, the function writes a 
zero-terminated string to the buffer.


Thank you very much ! I forgot it.



How to convert C macro to D? Thanks.

2018-02-24 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,

I can convert some simple C macros, but a bit more complicated 
will need your help.

For example:

#define _NDIS_CONTROL_CODE(request,method) \
CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, request, 
method, FILE_ANY_ACCESS)


#define IOCTL_NDIS_QUERY_GLOBAL_STATS   _NDIS_CONTROL_CODE(0, 
METHOD_OUT_DIRECT)


use alias or enum,how to do?

Thanks.


Re: How to convert C macro to D? Thanks.

2018-02-24 Thread FrankLike via Digitalmars-d-learn
On Saturday, 24 February 2018 at 13:57:27 UTC, Adam D. Ruppe 
wrote:

On Saturday, 24 February 2018 at 13:50:16 UTC, FrankLike wrote:
#define IOCTL_NDIS_QUERY_GLOBAL_STATS   _NDIS_CONTROL_CODE(0, 
METHOD_OUT_DIRECT)



auto IOCTL_NDIS_QUERY_GLOBAL_STATS () {
  return _NDIS_CONTROL_CODE(0, METHOD_OUT_DIRECT);
}


Sorry.

I look for 'IOCTL_DISK_GET_DRIVE_GEOMETRY' in 
core.sys.windows.winioctl.d,then I know :


enum :DWORD IOCTL_NDIS_QUERY_GLOBAL_STATS = 
CTL_CODE_T!(FILE_DEVICE_PHYSICAL_NETCARD, 0, METHOD_OUT_DIRECT, 
FILE_ANY_ACCESS);


It's ok.

Thank you.


Where can get the strsafe.d by strsafe.h ? Thanks.

2018-02-24 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,
Now,I use some code in strsafe.h,but where can get the strsafe.d ?

Thanks.


How to compile C++ and D code, and linking them together on Windows, I will use c++ function In D? Thanks.

2018-02-25 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,

How to compile C++ and D code, and  linking them together  on 
Windows ? I will use c++ function In D.

I use vs2010 c++ on Windows, What should I do?
For example:

1. create 2 files: C++.cpp  D.d
2. I get the C++.obj fiel by vs2010.
3. I get the D.obj by dmd -c -m32mscoff

Then how to link? use Dmd's link or VC's link?
Now I use the VC's link,and dmd -c -m32mscoff.but get the 
error:phobos32mscoff.lib<...>:error LNK2001

Total 187 errors.

Thanks.




Re: Help using lubeck on Windows

2018-02-25 Thread FrankLike via Digitalmars-d-learn

On Sunday, 25 February 2018 at 14:26:24 UTC, Arredondo wrote:
On Friday, 23 February 2018 at 18:29:09 UTC, Ilya Yaroshenko 
wrote:



full days now. All the .lib/.a files I have tried for BLAS and

 to do:  dmd -L .\openblas.lib
 put the lib file in your code path.


Error 42: Symbol Undefined _cblas_dgemm
Error 42: Symbol Undefined _cblas_dger
Error: linker exited with status 2






Re: How to compile C++ and D code, and linking them together on Windows,I will use c++ function In D? Thanks.

2018-02-25 Thread FrankLike via Digitalmars-d-learn

On Sunday, 25 February 2018 at 15:38:31 UTC, FrankLike wrote:

Hi,everyone,

How to compile C++ and D code, and  linking them together  on 
Windows ? I will use c++ function In D.

I use vs2010 c++ on Windows, What should I do?
For example:

1. create 2 files: C++.cpp  D.d
2. I get the C++.obj fiel by vs2010.
3. I get the D.obj by dmd -c -m32mscoff

Then how to link? use Dmd's link or VC's link?
Now I use the VC's link,and dmd -c -m32mscoff.but get the 
error:phobos32mscoff.lib<...>:error LNK2001

Total 187 errors.

Thanks.


I've done it by myself.

Through ‘LINK’ each *.obj from D or C++,if there is no 
problem,linking them together,add 
parameters:/NODEFAULTLIB:libcmt.lib ,and not use /LTCG.


Ok.




Let dmd or ldc be easy to setup on Ubuntu

2015-12-22 Thread FrankLike via Digitalmars-d-learn

Now,we can't setup dmd or ldc like this:
 sudo apt-get install dmd
 sudo apt-get install ldc2

If I set 'The Installation Source' is :
deb http://downloads.dlang.org/releases/2015/ main

But it's error,why?

Thank you.


Re: Let dmd or ldc be easy to setup on Ubuntu

2015-12-22 Thread FrankLike via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 14:11:29 UTC, Rikki Cattermole 
wrote:

On 23/12/15 3:09 AM, FrankLike wrote:

Now,we can't setup dmd or ldc like this:
  sudo apt-get install dmd
  sudo apt-get install ldc2

If I set 'The Installation Source' is :
deb http://downloads.dlang.org/releases/2015/ main

But it's error,why?

Thank you.


dlang.org does not host a apt repository.

There is one on sourceforge for just this however.

http://d-apt.sourceforge.net/


deb http://d-apt.sourceforge.net/ trusty main

 'The Installation Source' is ok,but in Terminal it's error.
Do you have some detail about 'The Installation Source' for dmd 
or ldc?

Thank you.




Re: Let dmd or ldc be easy to setup on Ubuntu

2015-12-22 Thread FrankLike via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 14:37:21 UTC, Rikki Cattermole 
wrote:

I'm confused.
The commands listed e.g.

$ sudo wget 
http://netcologne.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list
$ sudo apt-get update && sudo apt-get -y 
--allow-unauthenticated install --reinstall d-apt-keyring && 
sudo apt-get update


Should work.
If it does not, please post output.


Sorry, it works,but can't get any useful info.


Re: Let dmd or ldc be easy to setup on Ubuntu

2015-12-22 Thread FrankLike via Digitalmars-d-learn

On Tuesday, 22 December 2015 at 15:08:20 UTC, FrankLike wrote:
On Tuesday, 22 December 2015 at 14:37:21 UTC, Rikki Cattermole 
wrote:

I'm confused.
The commands listed e.g.

$ sudo wget 
http://netcologne.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list
$ sudo apt-get update && sudo apt-get -y 
--allow-unauthenticated install --reinstall d-apt-keyring && 
sudo apt-get update


Should work.
If it does not, please post output.


Sorry, it works,but can't get any useful info.

sudo apt-get install dmd ← it's error.
Now I setup by double click the 'dmd_2.069.2-0-amd64.deb' 
file,and setup it.

then sudo apt-get install dub
it's ok.


How to use GDC for 'Raspberry Pi' on Linux x86_64?

2015-12-26 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,
I've download the arm-unknown-linux-gnueabi and 
arm-unknown-linux-gnueabihf,which is I must to use on ' Raspberry 
Pi'?

Now,I've chosen the  arm-unknown-linux-gnueabihf.That's ok?
I've made the hello.d,and made the hello.
The file 'hello' can be used on  'Raspberry Pi'?
Now I'm not having the  'Raspberry Pi'.

Thank you.


GCD build wiringPi for 'Raspberry Pi',here is error info

2015-12-26 Thread FrankLike via Digitalmars-d-learn
Hi,everyone,I build wiringPi for  'Raspberry 
Pi'.(http://wiringpi.com/)

Here is error info:
---gdcbuild
#! /bin/sh
dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d 
mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d mcp23x0817.d 
mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d pcf8591.d 
sn3218.d softPwm.d softServo.d softTone.d sr595.d wiringPi.d 
wiringPiI2C.d wiringPiSPI.d wiringSerial.d wiringShift.d 
wpiExtensions.d"


ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o  
mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o 
mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThead.o sn3218.o 
softPwm.o softServo.o softTone.o sr595.o wiringPi.o wiringPiI2C.o 
wiringPiSPI.o wiringSerial.o wiringShift.o wpiExtensions.o"


 /opt/arm-unknown-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc  -o 
aa.so $ofiels $dfiles  -shared



sudo ./gdcbuild
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(lifetime.o)(.text+0x30):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(lifetime.o)(.text+0x2e0):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(lifetime.o)(.text+0x3f0):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(lifetime.o)(.text+0x488):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(tlsgc.o)(.text+0x28):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(deh.o)(.text+0x158):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(deh.o)(.text+0x22c):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(deh.o)(.text+0x7e0):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(thread.o)(.text+0x4c):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(thread.o)(.text+0x50):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(thread.o)(.text+0x3b8):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/.

GDC build wiringPi for 'Raspberry Pi',here is error info

2015-12-26 Thread FrankLike via Digitalmars-d-learn
Hi,everyone,I build wiringPi for  'Raspberry Pi' by GDC 
(arm-unknown-linux-gnueabihf2.066.1).('wiringPi' download by 
http://wiringpi.com/)

Here is error info:
---gdcbuild
#! /bin/sh
dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d 
mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d mcp23x0817.d 
mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d pcf8591.d 
sn3218.d softPwm.d softServo.d softTone.d sr595.d wiringPi.d 
wiringPiI2C.d wiringPiSPI.d wiringSerial.d wiringShift.d 
wpiExtensions.d"


ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o  
mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o 
mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThead.o sn3218.o 
softPwm.o softServo.o softTone.o sr595.o wiringPi.o wiringPiI2C.o 
wiringPiSPI.o wiringSerial.o wiringShift.o wpiExtensions.o"


 /opt/arm-unknown-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc  -o 
aa.so $ofiels $dfiles  -shared



sudo ./gdcbuild
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(lifetime.o)(.text+0x30):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(lifetime.o)(.text+0x2e0):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(lifetime.o)(.text+0x3f0):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(lifetime.o)(.text+0x488):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(tlsgc.o)(.text+0x28):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(deh.o)(.text+0x158):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(deh.o)(.text+0x22c):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(deh.o)(.text+0x7e0):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(thread.o)(.text+0x4c):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(thread.o)(.text+0x50):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/lib/libgphobos2.a(thread.o)(.text+0x3b8):
 R_ARM_TLS_LE32 relocation not permitted in shared object
/opt/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/../../../../arm-unknown-linux-gnueabihf/bin/ld:
 
/opt/arm-unknow

How to use GDC to get .a file on Linux?

2015-12-27 Thread FrankLike via Digitalmars-d-learn

Hi,
   Now I need get the .a file on Linux,target system is ARM.
   If you use gcc ,you will use the 'ar' to get .a file,
but how to do by GDC ?
And how to  get the execute file by .a file and .d file?

Thank you.



Re: How to use GDC to get .a file on Linux?

2015-12-27 Thread FrankLike via Digitalmars-d-learn

On Sunday, 27 December 2015 at 15:24:17 UTC, tcak wrote:

On Sunday, 27 December 2015 at 15:19:21 UTC, FrankLike wrote:

Hi,
   Now I need get the .a file on Linux,target system is ARM.
   If you use gcc ,you will use the 'ar' to get .a file,
but how to do by GDC ?
And how to  get the execute file by .a file and .d file?

Thank you.


I couldn't have understood your question very well, but some 
information is here.


You create .a static library file with "-lib" flag while 
compiling. Yesterday I did it.


dmd mylib.d -lib

This will generate mylib.a.

You can later use this static library while compiling another d 
code.


dmd main.d mylib.a

Pass the .a file directly as it is another source.

I have never tried these with GDC, but I don't think it is much 
different at all.
Now I will target file to ARM linux,and dmd can't get the file 
for ARM.




How to config the GDC on linux target for ARM linux?

2015-12-27 Thread FrankLike via Digitalmars-d-learn
Now I build a project for ARM linux on ubuntu 15.04 ,but build 
error.
I download the 'wiringPi' from http://wiringPi.com,convert the 
*.h to *.d.then build the 'aa.so' file:

#! /bin/sh
dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d 
mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d mcp23x0817.d 
mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d pcf8591.d 
sn3218.d softPwm.d softServo.d softTone.d sr595.d wiringPi.d 
wiringPiI2C.d wiringPiSPI.d wiringSerial.d wiringShift.d 
wpiExtensions.d"


ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o  
mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o 
mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThead.o sn3218.o 
softPwm.o softServo.o softTone.o sr595.o wiringPi.o wiringPiI2C.o 
wiringPiSPI.o wiringSerial.o wiringShift.o wpiExtensions.o"


 /opt/arm-unknown-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc  -o 
aa.so $ofiels $dfiles  -shared

---my.d
import wiringPi;
import std.stdio;

void main()
{
writeln("start");
wiringPiSetup();
pinMode(0,OUTPUT);
while(1)
{
digitalWrite(0,HIGH);
delay(500);
digitalWrite(0,LOW);
delay(500);
}
return;
}
-build the my execute file
/opt/arm-unknown-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc  -o 
my  my.d aa.so -I./wiringPi/WiringPi/


-now get the error:
my.d:1:8: error: module wiringPi is in file 'wiringPi.d' which 
cannot be read

 import wiringPi;
^
import path[0] = 
/opt/arm-unknown-linux-gnueabihf/lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/include/d
-I copy the *.d to 
/opt/arm-unknown-linux-gnueabihf/lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/include/d

it's ok ,but where is the file for config?
-get another error:
/tmp/cc7M1B9I.o: In function `_Dmain':
my.d:(.text+0x60): undefined reference to `wiringPiSetup'
my.d:(.text+0x6c): undefined reference to `pinMode'
my.d:(.text+0x84): undefined reference to `digitalWrite'
my.d:(.text+0x8c): undefined reference to `delay'
my.d:(.text+0x98): undefined reference to `digitalWrite'
my.d:(.text+0xa0): undefined reference to `delay'
collect2: error: ld returned 1 exit status
-end

I'm not known the GDC config file ,and maybe I use the error 
build .

Who can help me?
 thank you.





Re: How to use GDC to get .a file on Linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

On Sunday, 27 December 2015 at 17:19:26 UTC, Mike Parker wrote:

On Sunday, 27 December 2015 at 15:19:21 UTC, FrankLike wrote:

Hi,
   Now I need get the .a file on Linux,target system is ARM.
   If you use gcc ,you will use the 'ar' to get .a file,
but how to do by GDC ?
And how to  get the execute file by .a file and .d file?

Thank you.


Just use ar on the generated object files the same way you 
would if you were using gcc.


Thank you,but the error is not ok.maybe some PATH is error,I 
don't how to set.


Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn
About the first error ("...module wiringPi is in file 
'wiringPi.d' which cannot be read...") - are you sure that the 
dfiles are in "./wiringPi/WiringPi/"? The compiler reports that 
it can't find them there.
You can try copying the WiringPi dfiles in the same folder as 
"my.d".


About the second error - you need to verify that aa.so actually 
has those symbols that the linker reports as "undefined 
reference". You can do this with readlelf or nm. For more info 
see 
here:http://stackoverflow.com/questions/1237575/how-do-i-find-out-what-all-symbols-are-exported-from-a-shared-object


Thank you,but can you tell me that what is right way to use GDC 
on linux,such as d refer a c lib.

for eacample:
a.d refer  x.h x.c
how  do you build it by GDC?
what's your steps?
How to config the GDC for the thirty c lib and d files.

Thank you,waiting for your answer.


Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

On Monday, 28 December 2015 at 13:17:04 UTC, FrankLike wrote:
About the first error ("...module wiringPi is in file 
'wiringPi.d' which cannot be read...") - are you sure that the 
dfiles are in "./wiringPi/WiringPi/"? The compiler reports 
that it can't find them there.
You can try copying the WiringPi dfiles in the same folder as 
"my.d".


About the second error - you need to verify that aa.so 
actually has those symbols that the linker reports as 
"undefined reference". You can do this with readlelf or nm. 
For more info see 
here:http://stackoverflow.com/questions/1237575/how-do-i-find-out-what-all-symbols-are-exported-from-a-shared-object


 Thank you,but can you tell me that what is right way to use GDC
 on linux,such as d refer a c lib.
for eacample:
a.d refer  x.h x.c
 how  do you build it by GDC?
 what's your steps?
 How to config the GDC for the third part c libaries and d 
files,such as PATH.


 Thank you,waiting for your answer.




Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

 I've gotten the answer: use the difference 'gcc' for c code.
---For x86_64:
#! /bin/sh
dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d 
mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d mcp23x0817.d 
mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d pcf8591.d 
sn3218.d softPwm.d softServo.d softTone.d sr595.d wiringPi.d 
wiringPiI2C.d wiringPiSPI.d wiringSerial.d wiringShift.d 
wpiExtensions.d"


ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o  
mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o 
mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThread.o sn3218.o 
softPwm.o softServo.o softTone.o sr595.o wiringPi.o wiringPiI2C.o 
wiringPiSPI.o wiringSerial.o wiringShift.o wpiExtensions.o"



gcc -c *.c -m64
/opt/x86_64-pc-linux-gnu/bin/x86_64-linux-gnu-gdc -o my my.d   
$ofiles -I$dfiles


For ARM:

#! /bin/sh
cfiles="wiringPi.c max31855.c max5322.c mcp23008.c mcp23016.c  
mcp23017.c mcp23s08.c mcp23s17.c mcp3002.c mcp3004.c mcp3422.c 
mcp4802.c pcf8574.c pcf8591.c sn3218.c softPwm.c softServo.c 
softTone.c sr595.c  wiringPiI2C.c wiringPiSPI.c wiringSerial.c 
wiringShift.c wpiExtensions.c"


dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d 
mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d mcp23x0817.d 
mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d pcf8591.d 
sn3218.d softPwm.d softServo.d softTone.d sr595.d wiringPi.d 
wiringPiI2C.d wiringPiSPI.d wiringSerial.d wiringShift.d 
wpiExtensions.d"


ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o  
mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o 
mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThread.o sn3218.o 
softPwm.o softServo.o softTone.o sr595.o wiringPi.o wiringPiI2C.o 
wiringPiSPI.o wiringSerial.o wiringShift.o wpiExtensions.o"


/opt/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc -marm  -c 
$cfiles
/opt/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gdc  -o my 
my.d   $ofiles -I$dfiles


Re: How to use GDC to get .a file on Linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

Answer is here:
http://forum.dlang.org/thread/txvntyahlaewutzzw...@forum.dlang.org




Re: GDC build wiringPi for 'Raspberry Pi',here is error info

2015-12-28 Thread FrankLike via Digitalmars-d-learn

Answer is here:
http://forum.dlang.org/thread/txvntyahlaewutzzw...@forum.dlang.org


Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

On Monday, 28 December 2015 at 15:23:19 UTC, FrankLike wrote:
 New Answer: I've gotten the answer: use the difference 'gcc' for 
c code.

 ---For x86_64:
 #! /bin/sh
 dfiles="max31855.d max5322.d mcp23008.d mcp23016.d
 mcp23016reg.d mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d
 mcp23x0817.d mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d
 pcf8591.d sn3218.d softPwm.d softServo.d softTone.d sr595.d
 wiringPi.d wiringPiI2C.d wiringPiSPI.d wiringSerial.d
 wiringShift.d wpiExtensions.d"

 ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o
 mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o
 mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThread.o sn3218.o
 softPwm.o softServo.o softTone.o sr595.o wiringPi.o
 wiringPiI2C.o wiringPiSPI.o wiringSerial.o wiringShift.o
 wpiExtensions.o"


 gcc -c *.c -m64
 /opt/x86_64-pc-linux-gnu/bin/x86_64-linux-gnu-gdc -o my my.d
 $ofiles -I$dfiles

 For ARM(add -I.):

 #! /bin/sh
 cfiles="wiringPi.c max31855.c max5322.c mcp23008.c mcp23016.c
 mcp23017.c mcp23s08.c mcp23s17.c mcp3002.c mcp3004.c mcp3422.c
 mcp4802.c pcf8574.c pcf8591.c sn3218.c softPwm.c softServo.c
 softTone.c sr595.c  wiringPiI2C.c wiringPiSPI.c wiringSerial.c
 wiringShift.c wpiExtensions.c"

 dfiles="max31855.d max5322.d mcp23008.d mcp23016.d
 mcp23016reg.d mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d
 mcp23x0817.d mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d
 pcf8591.d sn3218.d softPwm.d softServo.d softTone.d sr595.d
 wiringPi.d wiringPiI2C.d wiringPiSPI.d wiringSerial.d
 wiringShift.d wpiExtensions.d"

 ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o
 mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o
 mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThread.o sn3218.o
 softPwm.o softServo.o softTone.o sr595.o wiringPi.o
 wiringPiI2C.o wiringPiSPI.o wiringSerial.o wiringShift.o
 wpiExtensions.o"

 
/opt/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc -marm  -c $cfiles -I.
 
/opt/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gdc  -o my my.d   $ofiles -I$dfiles





Re: Must I compile on the target architecture?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote:

Hi, just a quick question:

If I write a program in D and I use Windows for development but 
want it to run on Linux, do I have to copy the source code to 
the target Linux machine and compile it there, to make an 
executable for that machine? What is the standard process for 
cross platform compilation?


GDC is best for cross platform compilation,download it from 
gdcproject.org.


How to set the Path to access the phone on windows?

2016-03-02 Thread FrankLike via Digitalmars-d-learn

Hi,everyone:

I want to access the phone on Windows7,but get a error:

std.file.FileException@std\file.d(3368):\\computer\myPhone\SDCard\myfiles:


0x0041c112
0x0043E601


The error is only on Windows7,it's ok on linux,I doubt it's not a 
error with file.d,maybe a error on Path on Windows.


Who can help me?

Thank you.

Frank.



Whether there is a same module likt C#'s "Windows.Storage" NameSpace?

2016-03-05 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,
Whether there is a module, like C#'s "Windows.Storage" 
NameSpace, you can operate the Android phone or ios phone, you 
can open the phone's folder on windows7?


Thank you .

Frank.


Re: Best way to check for an element in an array?

2014-04-23 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,
This code must add the 'break',
import std.stdio;
int x=0;
template isin(T){
bool isin(T[] Array,T Element){
bool rtn=false;
foreach(T ArrayElement; Array){
if(Element==ArrayElement){
rtn=true; break;  ← //here add break
}
 x++;
}
return rtn;
}
}

void main(string[] args)
{
int[] stuff=[0,1,2,3,4,5,6,7,8,9,10];  ← //here declare int[]

if (stuff.isin(2)) // Much clean!
{
writeln(x);
writeln("Hello World!");
}
}
end---

Frank


Re: Best way to check for an element in an array?

2014-04-23 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,
 It works maybe the best:

import std.stdio;

template isin(T){
bool isin(T[] Array,T Element){
foreach(T ArrayElement; Array){
if(Element==ArrayElement){ return true;}
}
return false;
}
}

void main(string[] args)
{
int[] stuff=[0,1,2,3,4,5,6,7,8,9,10];

if (stuff.isin(2))
{
writeln("Hello World!");
}

string[] strs =["Hello","world","hi","Everyone"];
if(strs.isin("Hi"))
{
writeln("find Hi");
}
else
{
writeln("not find Hi from: "~strs);
}
}

  end---

  Frank



I have modified the DFL to X64,but it's not work ,who know why not work?

2014-04-30 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,
I have modified the DFL's d files ,now it can get x86 libs,and 
can get x64 libs.

on x86, dfl.lib works ok,but on x64 dfl64.lib works not ok.
This is my makelib64.bat ,who can help me?

makelib64_libs.bat:make some libs for make dfl 
libs--

@rem   Make DFL x64.
@rem   http://www.dprogramming.com/dfl.php

@rem   Requires DMD and DMC's libs
@rem   Free downloads from 
http://www.digitalmars.com/d/dcompiler.html and 
http://www.digitalmars.com/download/freecompiler.html


@echo off
title D Build Environment  dmd Compiler x64
echo Welcome to ues D Compiler ,dmd 2014
echo.
SET VCINSTALLDIR=%VS100COMNTOOLS%..\..\VC

call "%VCINSTALLDIR%\vcvarsall.bat" amd64

@echo off
@cls


@rem   Either set the environment variables dmd_path and dmc_path
@rem   or fix the paths below.

if not "%dmd_path%" == "" goto dmd_set
set dmd_path=d:\d\dmd2
:dmd_set
set dmd_path_windows=%dmd_path%\windows
if not exist %dmd_path_windows%\bin\dmd.exe set 
dmd_path_windows=%dmd_path%

if not "%dmc_path%" == "" goto dmc_set
set dmc_path=d:\d\dm
:dmc_set

if exist "%dmc_path%" goto got_dmc
@rem @echo DMC not found; using DMD path (if you get errors, 
install DMC)

set dmc_path=%dmd_path_windows%
:got_dmc

@rem   DMC's Basic Utilities required to make these libs.
%dmc_path%\bin\implib user64_dfl.lib user32_dfl.def

%dmc_path%\bin\implib shell64_dfl.lib shell32_dfl.def


pause
---MakeDFLx64.lib-
@rem   Make DFL x64.
@rem   http://www.dprogramming.com/dfl.php

@rem   Requires DMD and DMC's libs
@rem   Free downloads from 
http://www.digitalmars.com/d/dcompiler.html and 
http://www.digitalmars.com/download/freecompiler.html


@echo off
title D Build Environment  dmd Compiler x64
echo Welcome to ues D Compiler ,dmd 2014
echo.
SET VCINSTALLDIR=%VS100COMNTOOLS%..\..\VC

call "%VCINSTALLDIR%\vcvarsall.bat" amd64

@echo off
@cls

call makelib64_libs.bat

@rem   Either set the environment variables dmd_path and dmc_path
@rem   or fix the paths below.

if not "%dmd_path%" == "" goto dmd_set
set dmd_path=d:\d\dmd2
:dmd_set
set dmd_path_windows=%dmd_path%\windows
if not exist %dmd_path_windows%\bin\dmd.exe set 
dmd_path_windows=%dmd_path%

if not "%dmc_path%" == "" goto dmc_set
set dmc_path=d:\d\dm
:dmc_set

if exist "%dmc_path%" goto got_dmc
@rem @echo DMC not found; using DMD path (if you get errors, 
install DMC)

set dmc_path=%dmd_path_windows%
:got_dmc

@rem   DMC's Basic Utilities required to make these libs.
@rem   %dmc_path%\bin\implib user64_dfl.lib user32_dfl.def
@rem   @if errorlevel 1 goto oops
@rem   %dmc_path%\bin\implib shell64_dfl.lib shell32_dfl.def
@rem   @if errorlevel 1 goto oops

set _stdcwindowsd=
set _stdcwindowsobj=
if not "%dlib%" == "Tango" goto dfl_not_tango_files
set _stdcwindowsd=internal/_stdcwindows.d
set _stdcwindowsobj=_stdcwindows.obj
:dfl_not_tango_files

set dfl_files=package.d all.d base.d application.d 
internal/dlib.d internal/clib.d internal/utf.d internal/com.d 
control.d clippingform.d form.d registry.d drawing.d menu.d 
notifyicon.d commondialog.d filedialog.d folderdialog.d panel.d 
textbox.d richtextbox.d picturebox.d listbox.d groupbox.d 
splitter.d usercontrol.d button.d label.d collections.d 
internal/winapi.d internal/wincom.d event.d socket.d timer.d 
environment.d messagebox.d tooltip.d combobox.d treeview.d 
tabcontrol.d colordialog.d listview.d data.d clipboard.d 
fontdialog.d progressbar.d resources.d statusbar.d imagelist.d 
toolbar.d %_stdcwindowsd%


set dfl_objs=package.obj all.obj base.obj application.obj 
dlib.obj clib.obj utf.obj com.obj control.obj clippingform.obj 
form.obj registry.obj drawing.obj menu.obj notifyicon.obj 
commondialog.obj filedialog.obj folderdialog.obj panel.obj 
textbox.obj richtextbox.obj picturebox.obj listbox.obj 
groupbox.obj splitter.obj usercontrol.obj button.obj label.obj 
collections.obj winapi.obj wincom.obj event.obj socket.obj 
timer.obj environment.obj messagebox.obj tooltip.obj combobox.obj 
treeview.obj tabcontrol.obj colordialog.obj listview.obj data.obj 
clipboard.obj fontdialog.obj progressbar.obj resources.obj 
statusbar.obj imagelist.obj toolbar.obj %_stdcwindowsobj%


@rem   Also update link pragmas for build.
set dfl_libs_dfl=user64_dfl.lib shell64_dfl.lib olepro32_dfl.lib
set dfl_libs=%dmc_path%\lib\gdi32.lib %dmc_path%\lib\comctl32.lib 
%dmc_path%\lib\advapi32.lib %dmc_path%\lib\comdlg32.lib 
%dmc_path%\lib\ole32.lib %dmc_path%\lib\uuid.lib 
%dmd_path_windows%\lib\ws2_32.lib %dfl_libs_dfl%


@rem   -version=NO_DRAG_DROP -version=NO_MDI
@rem   -debug=SHOW_MESSAGE_INFO -debug=MESSAGE_PAUSE
@rem set dfl_flags=%dfl_flags% -debug=SHOW_MESSAGENFO
set _dfl_flags=%dfl_flags% -wi

if not "%dfl_debug_flags%" == "" goto dfl_debug_flags_set
set dfl_debug_flags=-debug -g
:dfl_debug_flags_set

if not "%dfl_release_flags%" == "" goto dfl_release_flags_set
@remif not "%dlib%" == "Tango" goto dfl_not_release_tango
@rem	echo Due to a bug in DMD, release mode 

Re: A lot of people want to use D,but they only know MS SQL Server,what will help them to Learn D?

2014-05-01 Thread FrankLike via Digitalmars-d-learn

On Monday, 14 April 2014 at 17:13:56 UTC, FrankLike wrote:


My advice - use ODBC, it is the fastest way you may connect to 
the SQL server, and you already have everything you need for 
that. :)


Regards


I have test the d\dmd2\windows\lib\odbc32.lib,the size is 4.5kb,
I test it by test.d(build :dmd test.d)
but find the error:
Error 42:Symbol Undefined _SQLFreeHandle@8
Error 42:Symbol Undefined _SQLSetEnvAttr@16
Error 42:Symbol Undefined _SQLAllocHandle@12
Error 42:Symbol Undefined _SQLGetDiagRec@32
-- errorlevel 4


 I have fixed the errors.
The exe file only 210kb,it works very good.

Where the errors is ?
In the odbc32.def file.
must set the all used function names.
such as:
 _SQLFreeHandle@8   = SQLFreeHandle

Ok.
Frank.



Re: "Error 42: Symbol Undefined" for asserts

2014-05-02 Thread FrankLike via Digitalmars-d-learn

Maybe not add -L+somelib.lib


Dlangui can't build x64 example1.exe , because the size_t is ulong on winx64

2014-05-03 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,

I build the dlangui on win7 x64,use the debug win32,it can get 
the example1.exe,

but use the debug x64,not get the exe file,the error is
	Error: function pointer FreeImage_OpenMemory (ubyte* data = 
null, uint size_in_bytes = 0u) is not callable using argument 
types (ubyte*, 
ulong)	x:\GitHub\dlangui\src\dlangui\graphics\images.d	93	


the reason is the function 'FreeImage_OpenMemory',
it decalres that 'alias da_FreeImage_OpenMemory = FIMEMORY* 
function( BYTE* data = null, DWORD size_in_bytes = 0 )' ,but it's 
args is ulong.


if the size_t not change on x64,and add the new 'longlength' 
maybe a good idea.
Many Projects want to move on x64,but must modify the error 
'size_t  is ulong'.

Then stop to do. if the size_t is not change,  maybe a good idea.

Frank.


Re: "Error 42: Symbol Undefined" for asserts

2014-05-03 Thread FrankLike via Digitalmars-d-learn


The problem I am running in to now is that Xamarin Studio now 
launches Test.pdb.exe which doesn't seem to do anything at all.


Use  visual d,it's simple for using pdb.exe


The writeln() function's args can't be ["一" ,"二"]?

2014-05-06 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,

I find the The writeln()  function's args  can't be ["一" ,"二"]?
why?

Thank you.

Frank.


Re: The writeln() function's args can't be ["一" ,"二"]?

2014-05-06 Thread FrankLike via Digitalmars-d-learn

The problem is that you have a wide-character comma (,) there.

This works:

void main() {
writeln(["一", "二"]);
}


No,I mean the execute result is error.That doesn't get the ["一", 
"二"],but get the ["涓C","浜?].


Why?

Thank you.

Frank.


Re: The writeln() function's args can't be ["一" ,"二"]?

2014-05-06 Thread FrankLike via Digitalmars-d-learn

On Tuesday, 6 May 2014 at 15:03:11 UTC, Regan Heath wrote:
On Tue, 06 May 2014 15:48:44 +0100, Marc Schütz 
 wrote:



On Tuesday, 6 May 2014 at 13:35:57 UTC, FrankLike wrote:
The problem is that you have a wide-character comma (,) 
there.


This works:

  void main() {
  writeln(["一", "二"]);
  }


No,I mean the execute result is error.That doesn't get the 
["一", "二"],but get the ["涓C","浜?].


Why?

Thank you.

Frank.


It works for me (Linux). If you're on Windows, it could have 
something to do with Windows' handling of Unicode, but I don't 
know enough about that to help you. There were posts about 
this in this newsgroup, maybe you can find them, or someone 
else remembers and can tell you directly...


IIRC you need to type "chcp 65001" and set the command prompt 
to the Lucida font...


R


No,it's error.My OS is windows 7,chcp 936. SimpleChinese.
I use the 'go language' to test
'fmt.println("一, 二")'
Then  execute result is :一, 二.
It's ok.
But D is error:涓C,浜?.

Why?

Thank you.

Frank.




Re: The writeln() function's args can't be ["一" ,"二"]?

2014-05-06 Thread FrankLike via Digitalmars-d-learn


That is understandable: Since the console is set to 936, it 
interprets D program's UTF-8 output incorrectly.


Please do what Regan Heath says and test again:

1) Set the code page to 65001

2) Use a font that includes your Unicode characters

Ali


Thank you.

I modify  it by the 'Regedit'(my OS is windows 7 x64):
open Regedit, find 'HKEY_CURRENT_USER\Console'
find the CodePage,Double Click,
then modify the type to 'decimal system',and modify the value to 
65001.

That's all.

Thank you,everyone.

Frank.


Down the VisualD0.3.38-1.exe ,found virus!

2014-05-08 Thread FrankLike via Digitalmars-d-learn

Hi,everyone,
down VisulaD from 
http://rainers.github.io/visuald/visuald/StartPage.html

found the virus:Win32.Troj.Undef.(kcloud)

Why?

Frank


Re: Down the VisualD0.3.38-1.exe ,found virus!

2014-05-08 Thread FrankLike via Digitalmars-d-learn

Most probably a false positive. What antivir do you use?



http://www.ijinshan.com/duba/newduba.shtml


vibe.d's example is good,but Memory Usage is bigger than beeblog?

2014-05-08 Thread FrankLike via Digitalmars-d-learn
I build the vibe.d's example: http-server-example,the exe's size 
is 5M ,it's very good, is better than go's beeblog,the beeblog's 
size is 12M.


I very like D,but the Memory Usage is bigger than go's exe.
http-server-example.exe's Memory Usage is 3.5M,but the beeblog's 
Memory Usage is 2.5M,I don't believe it,really?
I very hope vibe.d should have a lowwer Memory Usage than go's 
exe's.


Like D.

Frank


Re: vibe.d's example is good, but Memory Usage is bigger than beeblog?

2014-05-08 Thread FrankLike via Digitalmars-d-learn


The form-interface-example.exe's Memory Usage is 3.5M,if have 
some error,then Memory Usage is 6.7M,if error is closed,the 
Memory Usage keeps in 6.7M ,until you close the exe.


the error :such as

'500 - Internal Server Error

Internal Server Error

Internal error information:
object.Exception@..\..\source\vibe\http\form.d(234): No method 
found that matches the found form data:
Overload 
addUser(vibe.http.server.HTTPServerRequest,vibe.http.server.HTTPServerResponse,immutable(char)[],immutable(char)[],immutable(char)[]) 
failed: '




Like D.
Frank





How to use 'Heat the compiler' to vibe.d?

2014-05-08 Thread FrankLike via Digitalmars-d-learn

How to use 'Heat the compiler' to vibe.d?

If you can not stop the exe ,how to do?

Thank you.

Frank


Re: Down the VisualD0.3.38-1.exe ,found virus!

2014-05-10 Thread FrankLike via Digitalmars-d-learn


I've been using VisualD for a long time without problems. If it 
makes you nervous, you can get the source from Github and 
compile it yourself.


Hello,Meta

When I compile the Visual D projects:

at first,I compile the 'build' project,then get some error:


--START ALL BUILD: PROJECT: c2d,  Debug Win32 --
Building ..\bin\Debug\c2d.lib...
Build time: 1 s
-- START ALL BUILD: PROJECT: vsi2d,  Debug Win32 --
Building ..\bin\Debug\vsi2d.exe...
Converting debug information...
Build time: 1 s
-- START ALL BUILD: PROJECT: build, Debug Win32 --
Building ..\bin\Debug\build.sdk...
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Building ..\bin\Debug\dte_idl.success failed!


Here is my VSSDK AND WINSDK:
VSSDK100Install = C:\Program Files (x86)\Microsoft Visual Studio 
2010 SDK SP1
WindowsSdkDir = C:\Program Files (x86)\Microsoft 
SDKs\Windows\v7.0A


How can I do?

Thank you.


Re: Down the VisualD0.3.38-1.exe ,found virus!

2014-05-10 Thread FrankLike via Digitalmars-d-learn



You have spaces in your path, which is not good. Put quotes 
around the file paths, like so:


VSSDK100Install = "C:\Program Files (x86)\Microsoft Visual 
Studio 2010 SDK SP1"
WindowsSdkDir = "C:\Program Files (x86)\Microsoft 
SDKs\Windows\v7.0A"


Thank  you.


Re: Down the VisualD0.3.38-1.exe ,found virus!

2014-05-10 Thread FrankLike via Digitalmars-d-learn
You have spaces in your path, which is not good. Put quotes 
around the file paths, like so:


VSSDK100Install = "C:\Program Files (x86)\Microsoft Visual 
Studio 2010 SDK SP1"
WindowsSdkDir = "C:\Program Files (x86)\Microsoft 
SDKs\Windows\v7.0A"


Sorry,Meta,

the problem still exists,but I compile it by bat file.
Then I compile the Visual D, found the error :
[1] cannot read file port\sharedvenusids.d
[2] no file in 'sdk/win32'

-- start all build: project: vsi, Debug Win32 --
Building ..\bin\Debug\vsi.lib...
Error: cannot read file port\sharedvenusids.d
Building ..\bin\Debug\vsi.lib failed!


Thank you,Meta


Re: Messy code in console

2014-05-10 Thread FrankLike via Digitalmars-d-learn
On Sunday, 11 May 2014 at 02:38:44 UTC, IceNature via 
Digitalmars-d-learn wrote:
When there are Chinese characters in the output, the console 
will   display messy code.I change the encoding of the 
source file into   UTF-8 or UTF-16,but the messy code is 
still there...

   I use the dmd 2.065,Visual Studio 2013 with VisualD.
   How to solve this problem?
   Thank you

You can get answer from here:
http://forum.dlang.org/thread/ucfpqgzzxcacqxkdr...@forum.dlang.org



Re: Messy code in console

2014-05-11 Thread FrankLike via Digitalmars-d-learn
On Sunday, 11 May 2014 at 06:35:26 UTC, IceNature via 
Digitalmars-d-learn wrote:
Thank you for your help. But if I change the default console 
encoding,will it affect other programs,making other console 
program show messy code?


Don't  affect,and you must set the font to  a  unicode font ,such 
as Lucida.





Re: Down the VisualD0.3.38-1.exe ,found virus!

2014-05-11 Thread FrankLike via Digitalmars-d-learn
There are some quotes missing when building the Debug 
configuration. I have committed a fix and also added the 
missing file reported in your other message (IIRC it is not 
needed by every VS SDK).


Thank you,I'll try it.

Frank



Re: Down the VisualD0.3.38-1.exe ,found virus!

2014-05-11 Thread FrankLike via Digitalmars-d-learn
There are some quotes missing when building the Debug 
configuration. I have committed a fix and also added the 
missing file reported in your other message (IIRC it is not 
needed by every VS SDK).


Sorry,Rainer Schuetze,
Here is some error when compile the VisualD:

--ERROR START
Building Resources\pkgcmd.cto
Command Line
set PATH=D:\D\dmd2\windows\bin;C:\Program Files (x86)\Microsoft 
SDKs\Windows\v7.0A\\bin;%PATH%

set DMD_LIB=D:\D\dmd2\windows\lib
set VS9SDKBIN=c:\l\vs9SDK\VisualStudioIntegration\Tools\Bin
set CTC=%VS9SDKBIN%\CTC.exe
if not exist "%CTC%" goto no_CTC
if not exist "C:\Program Files (x86)\Microsoft Visual Studio 
10.0\\Common7\Tools\vsvars32.bat" goto no_CTC

set PATH=%PATH%;%VS9SDKBIN%
call "C:\Program Files (x86)\Microsoft Visual Studio 
10.0\\Common7\Tools\vsvars32.bat"

if errorlevel 1 goto reportError
"%CTC%" Resources\pkgcmd.ctc Resources\pkgcmd.cto -Ccl -I.
goto reportError

:no_CTC
echo Warning: CTC.exe not found in %VS9SDKBIN%.
echo It is part of the VS2008 SDK and is needed to compile 
Resources\pkgcmd.ctc

if not exist Resources\pkgcmd.cto exit 1
echo Resources\pkgcmd.cto exists, so it is assumed to be up to 
date.
echo If the project rebuilt again and again with this message, 
touch Resources\pkgcmd.cto to make it newer than 
Resources\pkgcmd.ctc

:reportError
:reportError
if errorlevel 1 echo Building Resources\pkgcmd.cto failed!
Output
Warning: CTC.exe not found in 
c:\l\vs9SDK\VisualStudioIntegration\Tools\Bin.
It is part of the VS2008 SDK and is needed to compile 
Resources\pkgcmd.ctc

-ERROR END-

I found it always to overwite the file 
'visuald\visuald\Resources\pkgcmd.cto.build.cmd',let the 
'VS9SDKBIN=c:\l\vs9SDK\VisualStudioIntegration\Tools\Bin' not use

'%VSSDK100Install%VisualStudioIntegration\Tools\Bin' .
Then failed.

Thank you  again.

Frank


Re: Down the VisualD0.3.38-1.exe ,found virus!

2014-05-11 Thread FrankLike via Digitalmars-d-learn

On Monday, 12 May 2014 at 06:36:10 UTC, FrankLike wrote:
There are some quotes missing when building the Debug 
configuration. I have committed a fix and also added the 
missing file reported in your other message (IIRC it is not 
needed by every VS SDK).



 Sorry,Rainer Schuetze,
And there is a little error in sdk.bat
'(echo unexpected Visual Studio SDK installation at %VSISDKINC% 
&& exit /B 1)'

%VSISDKINC% should be "%VSISDKINC%"

Thank you again.

Frank




Re: Down the VisualD0.3.38-1.exe ,found virus!

2014-05-12 Thread FrankLike via Digitalmars-d-learn


ctc.exe is not distributed with the SDKs starting from VS2010, 
so mapping to a more recent version does not work. That's why 
there is a precompiled pkgcmd.cto file in the repository. 
You'll have to update its modification time to avoid the build 
process trying to generate it from pkgcmd.ctc every time.


The explicitely used c:\l\vs9SDK is my installation, I should 
add a check for %VSSDK90Install% here.


Sorry,Rainer Schuetze,

Use it ,this is a good idea:
set VSISDKINC=
if "%VSISDKINC%" == "" if not "%VSSDK120Install%" == "" set 
VSISDKINC=%VSSDK120Install%
if "%VSISDKINC%" == "" if not "%VSSDK110Install%" == "" set 
VSISDKINC=%VSSDK110Install%
if "%VSISDKINC%" == "" if not "%VSSDK100Install%" == "" set 
VSISDKINC=%VSSDK100Install%
if "%VSISDKINC%" == "" if not "%VSSDK90Install%" == "" set 
VSISDKINC=%VSSDK90Install%
if "%VSISDKINC%" == "" if not "%VSSDK80Install%" == "" set 
VSISDKINC=%VSSDK80Install%
if "%VSISDKINC%" == "" (echo could not detect the Visual Studio 
SDK && exit /B 1)




 Sorry,Rainer Schuetze,
And there is a little error in sdk.bat
'(echo unexpected Visual Studio SDK installation at 
%VSISDKINC% && exit

/B 1)'
%VSISDKINC% should be "%VSISDKINC%"



I agree it is a bit clearer with quotes, but echo still works 
without, doesn't it?


Not work now in VS2010.
The error is : '\Microsoft is '

Thank you.

Frank


DFL is the best UIcontrols for D,compare it to dwt, tkd,dtk,dlangui,anchovy......

2014-05-12 Thread FrankLike via Digitalmars-d-learn
1.DFL's Memory Usage is the least than other. winsamp.exe is 
2.1M,DFL's example's exe is 2.7M.
2.The size of DFL's example's exe files is the least than other, 
and only a single file.

3.DFL's source code is the most easy to understand.

Although DFL not use on Linux or Mac os X,it's easy to do for 
high level Software Engineer.


Now D need a simple ,quickly,easy to study UI Controls for D to 
develop.


Frank






How to use the 'ExecuteShell','execv','execvp' open the 'forum.dlang.org'?

2014-05-12 Thread FrankLike via Digitalmars-d-learn
If you offen open the  'forum.dlang.org',always want to open the 
web quickly,
but how to use the 'ExecuteShell','execv','execvp' open the 
'forum.dlang.org'?


module main;

import std.process,std.stdio;

void main()
{
const string[] urls =["http://localhost:8080";];
const string  s ="iexplore.exe";
execv(s,urls);
string url = "iexplore.exe http://forum.dlang.org/";;
auto i =executeShell(url);//escapeShellCommand("wget", url)
if(i.status !=0) writeln("fail open:",i);
else writeln(i.output);
}

Thank you.



Re: DFL is the best UIcontrols for D,compare it to dwt, tkd,dtk,dlangui,anchovy......

2014-05-12 Thread FrankLike via Digitalmars-d-learn

On Tuesday, 13 May 2014 at 06:24:27 UTC, Jacob Carlborg wrote:

On 13/05/14 02:10, FrankLike wrote:
1.DFL's Memory Usage is the least than other. winsamp.exe is 
2.1M,DFL's

example's exe is 2.7M.
2.The size of DFL's example's exe files is the least than 
other, and

only a single file.
3.DFL's source code is the most easy to understand.

Although DFL not use on Linux or Mac os X,it's easy to do for 
high level

Software Engineer.

Now D need a simple ,quickly,easy to study UI Controls for D 
to develop.


I would think it would get more complicated if it got support 
for other platforms. Also, without having looked at its 
features, I'm guessing it's not as comprehensive as DWT, Gtk or 
Qt.


Thank you.
DWT AND DFL ,their Memory Usage is the least .
but DWT is more complicated than DFL.

Look at the base control :Button
at DFL :only 270 lines ,
but at DWT: need >1400 lines.

Thank you again.


  1   2   >