winsamp.d dont compiler.
in C:\d\dmd2\samples\d winsamp.d dont compiler. dmd winsamp gdi32.lib winsamp.def winsamp.d(53): Error: function core.sys.windows.winuser.LoadIconA (void*, const(char)*) is not callable using argument types (typeof(null), wchar*) winsamp.d(54): Error: function core.sys.windows.winuser.LoadCursorA (void*, const(char)*) is not callable using argument types (typeof(null), wchar*) winsamp.d(57): Error: cannot implicitly convert expression (toStringz(className)) of type immutable(char)* to const(wchar)* winsamp.d(59): Error: function core.sys.windows.winuser.RegisterClassA (const(WNDCLASSA)*) is not callable using argument types (WNDCLASSW*) --- errorlevel 1
Re: winsamp.d dont compiler.
On Monday, 1 August 2016 at 00:27:27 UTC, Sean Campbell wrote: On Sunday, 31 July 2016 at 23:36:54 UTC, Cassio Butrico wrote: [...] There was changes made to core.sys.windows so it defaults to unicode. Try dmd winsamp gdi32.lib winsamp.def -version=ANSI or change all of the xxxA functions to xxxW and use toUTF16z (in stf.utf) instead of toStringz. thanks for listening I will try
Re: DMD + Dynamic Library.
On Wednesday, 8 March 2017 at 18:21:35 UTC, Damien Gibson wrote: On Wednesday, 8 March 2017 at 06:28:47 UTC, Jerry wrote: You have to use "export" for any symbol to be visible from a dll. On Windows by default nothing is exported. Would "export" and "export extern(D):" not be the same? Im confuseled.. You have to use extern (C) { import std.stdio; export{ void dllprint() { writeln("\nmydll.dll read ok!!!\n"); } int Myadd(int x, int y) { return x + y; } } }
Acruvex dll in D
I have this activex dll in vb6 and would like to be able to use it in D CClasexp.cls Public Function Add (X As Integer, and As Integer) Add = (X + y) End Function How do i instantiate activex dll in D?
Re: DMD + Dynamic Library.
On Wednesday, 15 March 2017 at 07:03:19 UTC, Damien Gibson wrote: If it helps to know i also get in the other little window that tells me the activate compiler commands and stuff that the symbols for the functions i called undefined while the other side just said library reference not found. I have an example of how to create a dll in d, read in c and d, if you want I can post the files, it's just an example to clarify, I use windows 10 32b and dmd 2.72 - yes my english is Too bad ... sorry. I speak Brazilian Portuguese.
Re: Building library
On Thursday, 28 August 2014 at 19:29:40 UTC, papaboo wrote: Hey I've just started getting into D and so far I'm just messing around with it in a small math library. However I've run into an issue while trying to build a library and linking it with my main file. My current file and module layout is test.d src/math/vector.d - module dragonfly.math.vector src/math/quaternion.d - module dragonfly.math.quaternion Compiling with $ dmd test.d src/math/vector.d src/math/quaternion.d && ./test works perfectly and runs the way I would expect. I then tried to compile a library as described http://ddili.org/ders/d.en/modules.html, so basically $ dmd src/math/vector.d src/math/quaternion.d -lib -ofmath -w $ dmd math.a test.d && ./test But this fails with the following error test.d(5): Error: module vector is in file 'dragonfly/math/vector.d' which cannot be read I realize I placed my files in a 'src' dir instead of 'dragonfly', but shouldn't explicitly declaring the module name in vector.d and quaternion.d fix that? I'm compiling with dmd v 2.065 Hope someone has an answer for me so I can continue experimenting with D. try in vector.d type in fist line. module src.math.vetor; in quaternion.d module src.math.quaternion; save e compile.
tried to use wstring in my terminal and see what happened.
Anyone help me... I am using the version for the windows dmd v 2.066 to last I believe. tried to use wstring in my terminal and see what happened. wstring name; write("wstring - write a name: "); //readf("%s\n", &name); name = cast(wstring)chomp(readln()); //name = to!wstring(chomp(readln()));// with accent runtime error utf writeln("name length - ",name.length," - ",name); string namec = cast(string)name;// // string namec = to!string(name); writeln("namec length - ",namec.length," - ", namec); writeln("you write: ",namec," ok."); wstring - write a name: cassio name length - 3 - µàúþì│µ¢® namec length - 6 - cassio you write: cassio ok. or this wstring name; write("wstring - write a name: "); readf("%s\n", &name); //name = cast(wstring)chomp(readln()); //name = to!wstring(chomp(readln()));// with accent runtime error utf writeln("name length - ",name.length," - ",name); string namec = cast(string)name;// // string namec = to!string(name); writeln("namec length - ",namec.length," - ", namec); writeln("you write: ",namec," ok."); wstring - write a name: cassio name length - 6 - cassio namec length - 12 - c a s s i o you write: c a s s i o ok. very strange do not you think? I tried several times changing conversions to cast. to! ... question what I'm doing wrong? sorry English is not my official language. aguem pode me ajudar? estou usando a versão para win do dmd v 2.066 a ultima creio eu. tentei usar wstring no meu terminal e veja o que aconteceu. muito estranho não acha? tentei varias vezes mudando as conversões de cast para . to! ... pergunta o que estou fazendo de errado? desculpe-me ingles não e minha lingua oficial.
I can ask questions about dmd on windows here in this forum?
I'm new to this language, and I wonder if I will have some support simple questions. Thank you for your attention.
Re: I can ask questions about dmd on windows here in this forum?
On Sunday, 31 August 2014 at 03:20:00 UTC, Vladimir Panteleev wrote: On Sunday, 31 August 2014 at 03:16:38 UTC, Cassio Butrico wrote: I'm new to this language, and I wonder if I will have some support simple questions. Thank you for your attention. Yes. My question is about wstring and dstring, which and the best way to input data, converting and which should I use
Re: tried to use wstring in my terminal and see what happened.
On Sunday, 31 August 2014 at 03:18:57 UTC, Vladimir Panteleev wrote: On Friday, 29 August 2014 at 22:01:58 UTC, Cassio Butrico wrote: Anyone help me... I am using the version for the windows dmd v 2.066 to last I believe. tried to use wstring in my terminal and see what happened. name = cast(wstring)chomp(readln()); This line is incorrect. You are telling the compiler to interpret an UTF-8 byte stream as if it was UTF-16. //name = to!wstring(chomp(readln()));// with accent runtime error utf This line is correct. If you are getting an UTF exception, that means that your terminal is not configured to use UTF-8. Your accent characters are probably encoded as an ASCII encoding, not UTF-8. I see you're posting from a Windows machine. On Windows, to switch the terminal to UTF-8, type this command first: chcp 65001 You can do this programmatically in your D program using SetConsoleCP and SetConsoleOutputCP. Note, though, that doing so can affect execution of your program from Windows batch files. Thank you for answering me so fast, I'm happy. I'll set the output of my terminal, and redo some tests. again thank you for your help. I was creating a way of resolveir this, create a repositoio up. https: //cassio_butr...@bitbucket.org/cassio_butrico/dic.git
Re: I can ask questions about dmd on windows here in this forum?
On Sunday, 31 August 2014 at 05:27:15 UTC, Ali Çehreli wrote: On 08/30/2014 08:37 PM, Cassio Butrico wrote: > My question is about wstring and dstring, > which and the best way to input data, converting and which should I use Unless there is a specific reason not to, use 'string'. When you really need random access to characters, then use 'dstring'. To input data, readf() is for formatted input: int i; readf(" %s", &i); When reading a whole line as a string, consider import std.stdio; import std.string; // ... string line = chomp(readln()); Ali Thanks so much for answering me. I was having trouble setting on my terminal in windows, I'm still trying to solve.
Re: I can ask questions about dmd on windows here in this forum?
On Sunday, 31 August 2014 at 06:08:46 UTC, Ali Çehreli wrote: On 08/30/2014 10:37 PM, Cassio Butrico wrote: I was having trouble setting on my terminal in windows, I'm still trying to solve. In addition to what Vladimir Panteleev said, you should also select a Unicode font for your terminal like Lucida Console. Basically: 1) Set the code page to 65001 by chcp 65001 2) Select a Unicode font from the console window's menu. You can set those two for the entire system. (I don't remember how.) As Vladimir Panteleev said, you can set both of those from inside each program as well. Ali Ali Çehreli you is very attentive, answering for me. I do not know how to use SetConsoleCP or SetConsoleOutputCP on a progrtama in d. I'll try to find out.
Re: I can ask questions about dmd on windows here in this forum?
On Tuesday, 2 September 2014 at 16:49:15 UTC, Kagamin wrote: On Sunday, 31 August 2014 at 08:37:40 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: D program should just use string unless it needs random-access, in which case, it should use dstring. Except that dstring is not fool-proof either when one needs to work at grapheme level. I'm actually learning it because I'm sure is a beautiful and easy language learning programs, so the time that there was no gui. the micros. saidades got me my TRS-80 when programmed in pascal and cobol.
Re: I can ask questions about dmd on windows here in this forum?
On Tuesday, 2 September 2014 at 20:12:12 UTC, Cassio Butrico wrote: On Tuesday, 2 September 2014 at 16:49:15 UTC, Kagamin wrote: On Sunday, 31 August 2014 at 08:37:40 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: D program should just use string unless it needs random-access, in which case, it should use dstring. Except that dstring is not fool-proof either when one needs to work at grapheme level. I'm actually learning it because I'm sure is a beautiful and easy language learning programs, so the time that there was no gui. the micros. saidades got me my TRS-80 when programmed in pascal and cobol. I miss me my TRS-80 when programmed in pascal and cobol. sorry hehe :)
Re: Building a string from n chars
On Wednesday, 3 September 2014 at 20:46:40 UTC, monarch_dodra wrote: On Wednesday, 3 September 2014 at 19:43:26 UTC, Nordlöw wrote: Is there a simpler way to way to s ~= repeat('*', n).array.to!string; if s has to be of type string? s ~= repeat('*', n).array(); Should be enough. Why the "to!string"? There's 1 useless allocation, but I think that's OK for code this trivial? Else, you can do: s.length+=n; s[$-n .. $] []= '*'; This is also relatively simple. The ownside is doing double assignement, as "length" will initialize new elements to "char.init". Probably not noticeable. There *might* be more "efficient" ways to do it, but I'd doubt it qualifies as "simpler". Or if it's really observeable. Are these good enough for you? hello Nordlöw a time I did something like that, see. string repet(string a, int i) { int b; string c; for(b=0;b<=i;b++) {c ~= a;} return c; } can be adapted to char[].
how to transform decial point "3.15" to "3,15" comma?
how to transform decial point "3.15" to "3,15" comma? Hello everyone, I am making a registry of real amounts, and need trasformar fractional numbers, so print coretamente. there is some routine that do this?
Re: how to transform decial point "3.15" to "3,15" comma?
how to transform decial point "3.15" to "3,15" comma? Hello everyone, I am making a registry of real amounts, and need trasformar fractional numbers, so print correctly. there is some routine that do this?
Re: how to transform decial point "3.15" to "3,15" comma?
On Monday, 15 September 2014 at 23:24:13 UTC, AsmMan wrote: On Monday, 15 September 2014 at 23:17:51 UTC, AsmMan wrote: On Monday, 15 September 2014 at 22:45:50 UTC, Cassio Butrico wrote: how to transform decial point "3.15" to "3,15" comma? Hello everyone, I am making a registry of real amounts, and need trasformar fractional numbers, so print coretamente. there is some routine that do this? Is the , (comma) the system decimal separator? if so, you can use C intero and include locale.h header (in D, the respective module) call setlocale(LC_NUMERIC, "") function and then printf("%g", 3.5) will output (if decimal separator is the comma): 3,5 I haven't tested it in D but I think D's writefln() will behave exactly same as C's printf().. but it didn't you're free to call C's printf() The code is the following: import std.stdio; import std.c.locale; void main() { setlocale(LC_NUMERIC, ""); writeln(3.5); // 3,5 } Okay, Thanks everyone, that was it
how to create and compile reesources for dmd 64
Hello everyone, When I create and compile resouces to 32 works perfect, but when I try to compilat of 64 error LNK1136: invalid or corrupt file. I do not know if it has to do with comverter COFF to OMF. can someone give me a light? Thank you for your attention.
Re: how to create and compile reesources for dmd 64
On Saturday, 20 September 2014 at 15:24:23 UTC, K.K. wrote: On Friday, 19 September 2014 at 22:20:59 UTC, Cassio Butrico wrote: Hello everyone, When I create and compile resouces to 32 works perfect, but when I try to compilat of 64 error LNK1136: invalid or corrupt file. I do not know if it has to do with comverter COFF to OMF. can someone give me a light? Thank you for your attention. Somebody correct me if I'm wrong, but I'm pretty sure dmd doesn't actually support or compile 64-bit, despite what it tries to tell you. If you really need 64bit than GDC will probably work. DMD compila sim para 64 b. e roda perfeitamente. so não consigo compilar os resources. Obrigado por tentar me ajudado voce foi o unico que tentou.
Re: how to create and compile reesources for dmd 64
On Saturday, 20 September 2014 at 20:33:36 UTC, Cassio Butrico wrote: On Saturday, 20 September 2014 at 15:24:23 UTC, K.K. wrote: On Friday, 19 September 2014 at 22:20:59 UTC, Cassio Butrico wrote: Hello everyone, When I create and compile resouces to 32 works perfect, but when I try to compilat of 64 error LNK1136: invalid or corrupt file. I do not know if it has to do with comverter COFF to OMF. can someone give me a light? Thank you for your attention. Somebody correct me if I'm wrong, but I'm pretty sure dmd doesn't actually support or compile 64-bit, despite what it tries to tell you. If you really need 64bit than GDC will probably work. DMD compiles yes to 64 b. and runs perfectly. so I can not compile the resources. Thanks for trying helping me you're the one who tried.
Re: how to create and compile reesources for dmd 64
On Sunday, 21 September 2014 at 10:56:38 UTC, Kagamin wrote: Can depend on how you compile resources. true, but I do not know what should I do to compile the resource so that it is accepted.
Re: how to create and compile reesources for dmd 64
On Sunday, 21 September 2014 at 19:45:58 UTC, Kagamin wrote: MinGW resource compiler can compile to both res and coff. For ms AFAIK (didn't use) the compiled resource should be additionally converted to coff. how to compile in mingw-w64 resource compiler? never used mingw :( instalai the minw64 today.
Re: how to create and compile reesources for dmd 64
On Sunday, 21 September 2014 at 21:41:41 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 21 Sep 2014 20:13:41 + Cassio Butrico via Digitalmars-d-learn wrote: how to compile in mingw-w64 resource compiler? it tooks the standard text .rc files and produces .res of COFF. smth like: === r.rc === #include "windows.h" 1024 ICON "icon.ico" then invoke windres from mingw like: windres.exe -i r.rc -o r.res and it will produre .res file that can be linked with ms linker (if i remember it right). take it all with a grain of salt though, i don't have windows and ms tools to check it. ok I'll try doing what you said, Thanks for the tip.
Re: how to create and compile reesources for dmd 64
On Sunday, 21 September 2014 at 22:07:47 UTC, Cassio Butrico wrote: On Sunday, 21 September 2014 at 21:41:41 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 21 Sep 2014 20:13:41 + Cassio Butrico via Digitalmars-d-learn wrote: how to compile in mingw-w64 resource compiler? it tooks the standard text .rc files and produces .res of COFF. smth like: === r.rc === #include "windows.h" 1024 ICON "icon.ico" then invoke windres from mingw like: windres.exe -i r.rc -o r.res and it will produre .res file that can be linked with ms linker (if i remember it right). take it all with a grain of salt though, i don't have windows and ms tools to check it. ok I'll try doing what you said, Thanks for the tip. The problem is how to convert COFF r.res in r.res OMF. do not know if there is a way that I found on the net did not help me. It is a little hard not having someone with the same operating systema to help me. But anyway Thanks, learned a few new things today.
Re: how to create and compile reesources for dmd 64
On Sunday, 21 September 2014 at 23:53:34 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 21 Sep 2014 23:46:05 + Cassio Butrico via Digitalmars-d-learn wrote: The problem is how to convert COFF r.res in r.res OMF. resulting '.res' is not COFF, it's "windows resource file format". some linkers supports it directly, but i'm not sure about VS linker. right, .res is not COFF, when compiling in dmd. dmd r.res test.d works but dmd -m64 r.res test.d of error in r.res and that's it.
Re: how to create and compile reesources for dmd 64
On Monday, 22 September 2014 at 00:12:11 UTC, Cassio Butrico wrote: On Sunday, 21 September 2014 at 23:53:34 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 21 Sep 2014 23:46:05 + Cassio Butrico via Digitalmars-d-learn wrote: The problem is how to convert COFF r.res in r.res OMF. resulting '.res' is not COFF, it's "windows resource file format". some linkers supports it directly, but i'm not sure about VS linker. right, .res is not COFF, when compiling in dmd. dmd r.res test.d works but dmd -m64 r.res test.d of error in r.res and that's it. Does anyone managed to compile a one resource on 64 bit windows.
Re: How to output ascii character using terminal.d
On Friday, 24 April 2015 at 22:21:16 UTC, Adam D. Ruppe wrote: Also try cast(dchar) instead of cast(char), that might do what you need. a look at this https://github.com/cassio2014/DIC
setjmp / longjmp
Hello everyone , first congratulations for the wonderful forum , I wish someone could help me , I am writing a small basic interpreter in D and I am with some difficulties. estoutentando manupular the setjmp / longjmp buffers , but the error , I use windows 7 and the dmd 2067 , will be whose manipulate the buffers save and return ? Excuse my english sucks.
Re: setjmp / longjmp
On Sunday, 26 April 2015 at 05:56:46 UTC, ketmar wrote: On Sat, 25 Apr 2015 23:25:13 +, Cassio Butrico wrote: Hello everyone , first congratulations for the wonderful forum , I wish someone could help me , I am writing a small basic interpreter in D and I am with some difficulties. estoutentando manupular the setjmp / longjmp buffers , but the error , I use windows 7 and the dmd 2067 , will be whose manipulate the buffers save and return ? Excuse my english sucks. you shouldn't use setjmp/longjmp in D. use exceptions instead. something like this: instead of setjmp: try { doit } catch (MyException e) { process e } and instead of longjmp: throw new MyException(); Thank you for answering me ketmar I will try this
Re: setjmp / longjmp
I'm just building a small interpreter with a script and wanted to handle errors diverting the flow and returning . I am grateful for having responded my question , thank you.
Re: Binding to C
On Tuesday, 12 May 2015 at 03:20:34 UTC, TJB wrote: I'm sure this question has been asked a thousand times. I've even asked similar questions in the past (I've been away for quite a while). But all of the tutorials that I have found assume quite a lot and leave a lot to be inferred. Is there a simple step by step tutorial demonstrating how to call C code from D? With the separate file contents and names and compilation instructions? Thanks, TJB Hello if you work with Windows and has the vs2012 a look at this post https://github.com/cassio2014/DIC/tree/master/dic.v2/exemplos/dll%20in%20vs2012%20Cpp%20%20and%20read%20in%20D
Re: SysTime object from unixtime
see import std.stdio; import std.datetime; import std.process; void main() { auto ct = Clock.currTime; write("\n\n\tData: ",ct.day," / ",ct.month," / ",ct.year,".\n"); auto tv = Clock.currTime; write("\tHour: ", tv.hour,":", tv.minute,":", tv.second,".", tv.fracSec,"\n "); writeln("\n"); wait(spawnShell("pause")); }
Re: Writing to two files at once
If I understand right you want to redirect the output to a file by a flag , another file type , video printer is it?
Re: Writing to two files at once
On Thursday, 21 May 2015 at 21:16:59 UTC, wobbles wrote: On Thursday, 21 May 2015 at 21:00:15 UTC, Cassio Butrico wrote: If I understand right you want to redirect the output to a file by a flag , another file type , video printer is it? I think by video printer you mean the console? If so, yes. I believe I've solved it anyway, see Ali and my answer above. Thanks! You're right, Ali 's book is of great help for all
mouse pointer
can anyone tell me that how to change mouse pointer in D console. please tell me the code. I have tried many from the internet but that are not working well.
Re: mouse pointer
On Saturday, 6 June 2015 at 02:04:44 UTC, Adam D. Ruppe wrote: On Saturday, 6 June 2015 at 00:00:07 UTC, Cassio Butrico wrote: I have tried many from the internet but that are not working well. Link to one.. I'm not sure what you mean and seeing one of the possible solutions will help. in a console application can get the mouse position read if there was click etc .. but do not know if I can change the mouse pointer . Thanks for answering.
Re: mouse pointer
import std.stdio; import core.sys.windows.windows; int main(string[] args) { HANDLE hIn; HANDLE hOut; auto MouseWhere = COORD (18, 0); auto DClickWhere = COORD (18, 1); auto clickwher = COORD (18, 2); bool Continue = TRUE; DWORD EventCount; int LoopCount = 0; int KeyEvents = 0; INPUT_RECORD InRec; DWORD NumRead; hIn = GetStdHandle(STD_INPUT_HANDLE); hOut = GetStdHandle(STD_OUTPUT_HANDLE); writeln("Mouse is at = "); writeln("Double Click at = "); write ("Click at= "); stdout.flush(); while (Continue) { Sleep(10); // To slow it down!! GetNumberOfConsoleInputEvents(hIn,&EventCount); while (EventCount > 0) { ReadConsoleInputA(hIn,&InRec,1,&NumRead); if (InRec.EventType == KEY_EVENT) { if (InRec.KeyEvent.wVirtualKeyCode == VK_ESCAPE) { Continue = FALSE; } } else if (InRec.EventType == MOUSE_EVENT) { if (InRec.MouseEvent.dwEventFlags == MOUSE_MOVED) { SetConsoleCursorPosition(hOut, MouseWhere); write(InRec.MouseEvent.dwMousePosition.X ," : "); write(InRec.MouseEvent.dwMousePosition.Y ," "); stdout.flush(); } else if (InRec.MouseEvent.dwEventFlags == DOUBLE_CLICK) { SetConsoleCursorPosition(hOut, DClickWhere); write(InRec.MouseEvent.dwMousePosition.X ," : "); write(InRec.MouseEvent.dwMousePosition.Y ," "); stdout.flush(); } else if(InRec.MouseEvent.dwButtonState & FROM_LEFT_1ST_BUTTON_PRESSED) { SetConsoleCursorPosition(hOut, clickwher); write(InRec.MouseEvent.dwMousePosition.X ," : "); write(InRec.MouseEvent.dwMousePosition.Y ," "); stdout.flush(); } } GetNumberOfConsoleInputEvents(hIn,&EventCount); } } return 0; }
Re: mouse pointer
On Saturday, 6 June 2015 at 09:35:20 UTC, Kagamin wrote: On Saturday, 6 June 2015 at 02:45:55 UTC, Cassio Butrico wrote: in a console application can get the mouse position read if there was click etc .. but do not know if I can change the mouse pointer . Thanks for answering. You mean you want to change the position of mouse pointer? I actually wanted to change the mouse pointer , the arrow to hand, but do not know if it is possible .
Json
What does the .json file and how to use it?
Re: Json
Thank you for answering me so fast , where do I get the DUB for windows ?
Re: Json
On Friday, 12 June 2015 at 00:56:45 UTC, Ali Çehreli wrote: On 06/11/2015 04:58 PM, Cassio Butrico wrote: What does the .json file and how to use it? There is also the .json file that is produced by dmd's -X command line switch: dmd -X foo.d That outputs the members of the source code to foo.json in a way that may be useful for a tool. Ali Thanks Ali , I did not know that. :) I really like your tutorial is great for goods .