Re: compile: link dynamic OR static library in Windows

2023-02-05 Thread Alexander Zhirov via Digitalmars-d-learn
On Monday, 6 February 2023 at 06:59:09 UTC, Richard (Rikki) Andrew Cattermole wrote: On other platforms the -Lfile I think would work. On Windows you have to link against the import library not DLL directly. You can pass it to the compiler: $ dmd -i "-L/LIBPATH:C:\Program

Re: compile: link dynamic OR static library in Windows

2023-02-05 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On other platforms the -Lfile I think would work. On Windows you have to link against the import library not DLL directly. You can pass it to the compiler: $ dmd -i "-L/LIBPATH:C:\Program Files\PostgreSQL\15\lib" pq.lib app.d Should work. Sorry, I should have revisted this from the get go,

ImportC "no include path set"

2023-02-05 Thread Elfstone via Digitalmars-d-learn
I'm trying out ImportC, but I can't get even the "Quick Example" running. > dmd -v .\source\foobar.c predefs DigitalMars LittleEndian D_Version2 all Windows Win32 CRuntime_Microsoft CppRuntime_Microsoft D_InlineAsm D_InlineAsm_X86 X86 assert D_PreConditions D_PostConditions

Re: compile: link dynamic OR static library in Windows

2023-02-05 Thread Alexander Zhirov via Digitalmars-d-learn
On Monday, 6 February 2023 at 05:45:35 UTC, Richard (Rikki) Andrew Cattermole wrote: Ah doh, MSVC link doesn't use -L. $ dmd -i "-L/LIBPATH:C:\Program Files\PostgreSQL\15\lib" -Llpq app.d I think that is the option you want. Worst case scenario just copy the files to your working directory

Re: compile: link dynamic OR static library in Windows

2023-02-05 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Ah doh, MSVC link doesn't use -L. $ dmd -i "-L/LIBPATH:C:\Program Files\PostgreSQL\15\lib" -Llpq app.d I think that is the option you want. Worst case scenario just copy the files to your working directory and it should find it without the additional search path.

Re: compile: link dynamic OR static library in Windows

2023-02-05 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 06/02/2023 6:16 PM, Alexander Zhirov wrote: C:\sources\pxe-restore\source>dmd -i app.d -L'-LC:\Program Files\PostgreSQL\15\lib' -Llpq Source files go after flags. $ dmd -i -L'-LC:\Program Files\PostgreSQL\15\lib' -Llpq app.d

Re: compile: link dynamic OR static library in Windows

2023-02-05 Thread Alexander Zhirov via Digitalmars-d-learn
On Monday, 6 February 2023 at 05:20:33 UTC, Richard (Rikki) Andrew Cattermole wrote: Source files go after flags. $ dmd -i -L'-LC:\Program Files\PostgreSQL\15\lib' -Llpq app.d For some reason, the `obj` file is link instead of the library. ```sh C:\sources\pxe-restore\source>dmd

Re: compile: link dynamic OR static library in Windows

2023-02-05 Thread Alexander Zhirov via Digitalmars-d-learn
On Sunday, 5 February 2023 at 13:37:16 UTC, user1234 wrote: try ``` dmd -i app.d -L'-LC:\Program Files\PostgreSQL\15\lib' -Llpq ``` the first linker command gives a search path, the second a libname. It doesn't work ```sh C:\sources\pxe-restore\source>dmd -i app.d -L'-LC:\Program

Re: SFML D bindings: libsfml-system.so.2.5: cannot open shared object file:

2023-02-05 Thread thebluepandabear via Digitalmars-d-learn
Thanks. update: just set up a Manjaro vm and it seems to work, I guess I'll have no choice but to switch to Manjaro then if I want to use sfml

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-05 Thread thebluepandabear via Digitalmars-d-learn
I do not agree, that a compiler that allows a programmer to misuse a type, should be seen as 'a feature'. If that's the kind of 'power' D programmers want, then D is not for me. Eh, I don't think I would _quit_ D because of this issue, but it's definitely something that bothers me (more

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-05 Thread ProtectAndHide via Digitalmars-d-learn
On Sunday, 5 February 2023 at 23:53:35 UTC, Ali Çehreli wrote: On 2/5/23 14:40, ProtectAndHide wrote: > On Sunday, 5 February 2023 at 10:51:51 UTC, thebluepandabear wrote: >> >> It's not a terrible workaround to be honest. >> > > The 'terrible' part is this: > > - the compiler will allow

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-05 Thread thebluepandabear via Digitalmars-d-learn
On Sunday, 5 February 2023 at 23:53:35 UTC, Ali Çehreli wrote: On 2/5/23 14:40, ProtectAndHide wrote: > On Sunday, 5 February 2023 at 10:51:51 UTC, thebluepandabear wrote: >> >> It's not a terrible workaround to be honest. >> > > The 'terrible' part is this: > > - the compiler will allow

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-05 Thread thebluepandabear via Digitalmars-d-learn
On Sunday, 5 February 2023 at 23:50:35 UTC, Ali Çehreli wrote: On 2/5/23 02:57, thebluepandabear wrote: > When dealing with contexts, or for when you want a clear context in your > codebase, namespaces can be a life saver Can you give an example of a D problem that namespaces could solve? I

staticMap but with two arguments

2023-02-05 Thread John Chapman via Digitalmars-d-learn
I have two AliasSeqs: one containing a function's parameters (SourceSeq), the other containing the types I want to convert said parameters to (TargetSeq). I'd use something like staticMap to call the conversion function with both a parameter from SourceSeq and a type from TargetSeq, and return

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-05 Thread Ali Çehreli via Digitalmars-d-learn
On 2/5/23 14:40, ProtectAndHide wrote: > On Sunday, 5 February 2023 at 10:51:51 UTC, thebluepandabear wrote: >> >> It's not a terrible workaround to be honest. >> > > The 'terrible' part is this: > > - the compiler will allow you to declare a variable of type Algo > - the compiler will

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-05 Thread Ali Çehreli via Digitalmars-d-learn
On 2/5/23 02:57, thebluepandabear wrote: > When dealing with contexts, or for when you want a clear context in your > codebase, namespaces can be a life saver Can you give an example of a D problem that namespaces could solve? I have been with D for 14 years and haven't missed namespaces from

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-05 Thread ProtectAndHide via Digitalmars-d-learn
On Sunday, 5 February 2023 at 22:40:09 UTC, ProtectAndHide wrote: .. module test; import std; static final class Algo { @disable this(); static this() { Message = "Hello!"; } static: string Message; void drawLine() {}; } void main() { Algo foo1

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-05 Thread ProtectAndHide via Digitalmars-d-learn
On Sunday, 5 February 2023 at 10:51:51 UTC, thebluepandabear wrote: It's not a terrible workaround to be honest. The 'terrible' part is this: - the compiler will allow you to declare a variable of type Algo - the compiler will allow you to declare an array with elements of type Algo -

Re: betterC DLL in Windows

2023-02-05 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 05/02/2023 10:01 PM, Tamas wrote: On the surface, betterC seems to be perfect for this case. How would YOU do it (Adam, Richard)? BtW, gstreamer also has D bindings, and maybe in the future I'll use those. I suspect that Adam's suggestions have a stronger relevance to that case, right?

Re: compile: link dynamic OR static library in Windows

2023-02-05 Thread user1234 via Digitalmars-d-learn
On Sunday, 5 February 2023 at 11:52:01 UTC, Alexander Zhirov wrote: On Saturday, 4 February 2023 at 15:56:41 UTC, Richard (Rikki) Andrew Cattermole wrote: [...] I don't understand why the compiler doesn't see the library. ```sh User@WIN-D3SHRBHN7F6 MINGW64 /home/user/pxe-restore/source # ls

Re: compile: link dynamic OR static library in Windows

2023-02-05 Thread Alexander Zhirov via Digitalmars-d-learn
On Saturday, 4 February 2023 at 15:56:41 UTC, Richard (Rikki) Andrew Cattermole wrote: On Windows you don't link directly against a DLL. You link against a static library (.lib) of the same name. The binding doesn't change between a static library and a shared library as long as you're

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-05 Thread thebluepandabear via Digitalmars-d-learn
On Sunday, 5 February 2023 at 10:51:51 UTC, thebluepandabear wrote: { @disable this(); static this() { Message = "Hello!"; } static: string Message; void drawLine() {}; } It's not a terrible workaround to be honest. `static class` does have a use when

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-05 Thread thebluepandabear via Digitalmars-d-learn
{ @disable this(); static this() { Message = "Hello!"; } static: string Message; void drawLine() {}; } It's not a terrible workaround to be honest. `static class` does have a use when it's nested, so it might create some conflicts if such a feature

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-05 Thread ProtectAndHide via Digitalmars-d-learn
On Monday, 30 January 2023 at 21:54:49 UTC, thebluepandabear wrote: ... Interesting, so maybe there is a use case for a purely static type or namespace? The standard library as well uses `final abstract class` a couple of times, which can also be thought as a type of namespace. All these

Re: betterC DLL in Windows

2023-02-05 Thread Tamas via Digitalmars-d-learn
On Sunday, 5 February 2023 at 00:27:19 UTC, Richard (Rikki) Andrew Cattermole wrote: On 05/02/2023 1:20 PM, Adam D Ruppe wrote: Even module imports can fail because betterC disables outputting the module data info, even if it would otherwise be required by language rules, despite it not using

Re: betterC DLL in Windows

2023-02-05 Thread Tamas via Digitalmars-d-learn
On Sunday, 5 February 2023 at 00:20:24 UTC, Adam D Ruppe wrote: There's a lot of things described in the documentation that don't actually work. D can be an *extremely* productive language if you know which parts to focus on, but most the newer hyped features just don't deliver. The table of

Re: betterC DLL in Windows

2023-02-05 Thread Tamas via Digitalmars-d-learn
On Saturday, 4 February 2023 at 19:44:15 UTC, bachmeier wrote: On Saturday, 4 February 2023 at 18:29:41 UTC, Tamas wrote: What's the reason to prefer LDC over DMD? Anyone that cares about performance will use LDC rather than DMD. It's hard to imagine a case where someone would want betterC