On Monday, 19 February 2024 at 07:11:30 UTC, Kagamin wrote:
Docs say SSL_get0_peer_certificate was added in openssl 3.
I recompiled everything with :
DEFAULT_VERSIONS+= ssl=openssl31
With this setting vibe works fine on FreeBSD. Nice.
On Sunday, 18 February 2024 at 19:22:26 UTC, Sergey wrote:
On Sunday, 18 February 2024 at 13:23:53 UTC, Alain De Vos wrote:
DEFAULT_VERSIONS+= ssl=openssl111
Maybe also could be helpful to share your dub.json, compiler
version and OS version as well.
Compiler :
ldc2 --version :
LDC - the L
The error i get :
```
Up-to-date vibe-d 0.9.8: target for configuration [library] is up
to date.
Building t ~master: building configuration [application]
Linking t
ld: error: undefined symbol: SSL_get_peer_certificate
referenced by openssl.d:373
(../../.dub/packages/vibe-d/0.9.8/vibe
?
This works also,
```
class C {
int * pa;
int [] a;
// Constructor
this() {writefln("Called constructor");
pa=cast(int *)malloc(1000*int.sizeof);
a=pa[0..1000];
}
}
void dofun()
{
scope x=new C;
x.a[3]=5;
writefln("%12x",&x);
Here is i use new,
```
import std.stdio:writefln;
import object: destroy;
import core.memory: GC;
import core.stdc.stdlib: malloc,free;
import std.typecons;
class C {
int * pa;
int [] a;
// Constructor
this() {writefln("Called constructor");
pa=cast(int *)ma
This works also:
```
import std.stdio:writefln;
import object: destroy;
import core.memory: GC;
import core.stdc.stdlib: malloc,free;
import std.typecons;
class C {
int * pa;
int [] a;
// Constructor
this() {writefln("Called constructor");
pa=cast(int *)malloc(1000*int.si
The following code works:
```
import std.stdio:writefln;
import object: destroy;
import core.memory: GC;
import core.stdc.stdlib: malloc,free;
import std.typecons;
class C {
int * pa;
int [] a;
// Constructor
this() {writefln("Called constructor");
pa=cast(in
Maybe code above works when you enforce an Garbage-collection-run
?
Code below works fine. So you cannot use "new" but must use
malloc?
```
import std.stdio:writefln;
import object: destroy;
import core.memory: GC;
import core.stdc.stdlib: malloc,free;
void dofun(){
auto pa=cast(int *)m
Is it possible to print runtime memory usage of:
-The stack
-The heap
-The garbage collector ?
The following program prints two different addresses.
Meaning the new allocates memory until the program dies.
So the means memory leak by default ?
```
import std.stdio:writefln;
import object: destroy;
import core.memory: GC;
void dofun(){
auto a=new int[1000];
writefln("%12x",&a);
Is this ok ?
```
void main(){
int[] i=new int[1];
import object: destroy;
destroy(i);
import core.memory: GC;
GC.free(GC.addrOf(cast(void *)(i.ptr)));
}
```
Mixing D with C or C++ or Python is looking for problems.
Better write something in D.
And write something in C/C++/Python.
And have some form of communication between both.
```
call dutyl#register#tool('dcd-client','dcd-client')
call dutyl#register#tool('dcd-server','dcd-server')
call deoplete#custom#option('auto_complete_delay',200)
```
I managed after some tuning.
cat coc-settings.json
```
{
"languageserver": {
"d": {
"command": "/usr/home/x/serve-d/serve-d",
"filetypes": ["d"],
"trace.server": "on",
"r
Let's say i write
"write" press tab in neovim i want it to guess "writeln".
How to configure neovim for this.
[ Note "ncm2" lets my neovim crash. But maybe there are
alternatives ]
[ vscode is not an option as compiling electron takes ages]
why not try neovim.
Don't forget there is also BSD
Note.
How to do authentications & sessions ,is important, but badly
described.
It's possible to remove the "@" annotation & use the default
names of functions for the vibe framework,
E.g,
```
final class WebChat
{
// GET /
void get()
{
render!("index.dt", names);
}
void getEdit(string myid)
{
int id = myid.to!int;
string firs
Let's say i want to plot the function f(x)=sin(x)/x.
Which API would you advice, in order for me to not re-invent the
wheel.
Although the framework is good. There is no community. Or general
acceptance. Which is a pitty.
Currently I ask myself how to do "sessions" with vibe.d.
I seem to have found a solution.
Before starting neovim i do a,
dcd-server -I/usr/lib/ldc2/1.29/include/d
Automatic would be better.
I try neovim editor with the language server DCD but it seems no
symbols our found.
Could you guide me to solution ?
I find documentation of vibe.d between worse and bad, while the
framework is relative OK.
There are a few good links on the internet.
I post two of them.
Feel free to add other web links in order to increase our
knowledge.
https://vibed.org/blog/posts/a-scalable-chat-room-service-in-d
https:/
On Wednesday, 1 June 2022 at 15:23:14 UTC, Kagamin wrote:
Try to run clang with -v option and compare with gcc.
I've tracked down the problem to the solution where i specify as
linker to use gcc12 instead of a clang/llvm.
The following works.
```
export CC=clang14
ldc2 --link-defaultlib-share
I don't know if this helps but i have to do,
export CC=/usr/local/bin/gcc
with ldc2.
I don't know why it works with gcc but not with llvm/clang.
Note , it is also possible to do inline assembly with asm{...}
or __asm(T) {..}.
Could it be the copy constructor is only called during
assignments (like C++).
And for one, two there is an explicit assignment.
But not for three where there is a conversion ?
I don't know the answer. But some questions come to my mind.
Does Foo(3) lives on the stack or the heap ?
There is also no assignment from Foo to Foo for Foo(3), there is
a conversion.
And what happes with
Foo[3] arr = [one, two, Foo(3)];
Foo[] arr= [one, two, Foo(3)];
and
Foo x=Foo(3).dup()
As i personally did not used Windows the last 5 years, i use as
editor for any language:
neovim-qt. Someone else might answer about good Windows editors.
As for the other questions google "awesome dlang" will return
interesting results.
I consider Dlang general purpose as opposed to specialized
Nice , a lot of freedom with dmd & ldc.
How come i don't see commit activity on github ?.
The code is perfect or not maintained ?
Do DMD , GDC , LDC have the same or different licenses in use ?
What happened to Deimos and why ?
The detailed error is :
```
/usr/bin/clang test.o -o test -L/usr/local/lib -lphobos2-ldc
-ldruntime-ldc -Wl,--gc-sections -lexecinfo -lpthread -lm -m64
ld: error: undefined hidden symbol: __start___minfo
referenced by test.d
test.o:(ldc.register_dso)
```
Performed additional tests.
Compiling helloworld.d
```
export CC=gcc11 ; ldc2 helloworld.d
```
works fine.
Compiling helloworld.d
```
export CC=clang ; ldc2 helloworld.d
```
returns:
```
d: error: undefined hidden symbol: __start___minfo
referenced by test.d
test.o:(ldc.register_ds
Just looking at the error, are 2.098.1 & 2.100 , 100% compatible ?
Maybe i need to install additional phobos libraries ?
Thanks. rdmd.d compiled fine with ldc2.
But DCD did not build
dub build --build=release --config=client
produced the error:
msgpack-d-1.0.1 value.d error undefined identifier JSONType
I want to install the DCD language server on Raspberry PI4.
But the dub build for DCD requires rdmd which is not available.
Can I compile rdmd from source ? Or install a binary ?
[PS: I have ldc 1:1.24.0-2 installed ]
Or you could capture a sigint and close the file then.
You could try on linux,
apt-cache search dmd
apt-cache search ldc
apt-cache search ldc2
I tried neovim editor & serve-d and failed.
I tried kate editor & serve-d and failed.
https://github.com/Pure-D/serve-d
Anyone has a clue ?
Bugs in the clang/llvm toolchain but not in the gcc toolchain ?
The following worked , and i don't know what is going on:
```
ldc2 --gcc=gcc11
```
Let's say a shape is ,a circle with a radius ,or a square with a
rectangular size.
I want to pass shapes to functions, eg to draw them on the screen,
draw(myshape) or myshape.draw();
But how do i implement best shapes ?
The problem re-appeared and i have totally no idea what caused it.
ldc2 test.d
ld: error: undefined hidden symbol: __start___minfo
referenced by test.d
test.o:(ldc.register_dso)
ld: error: undefined hidden symbol: __stop___minfo
referenced by test.d
test.o:(ldc.regi
A new syntax like "*" should introduce something new.
If it's not needed for classes why introduce it.
If you don't know if something is a class name it class_blabla.
Just remember the effect of "="
Can i summarize ,
structs are value-objects which live on the stack.
class instances are reference objects which live on the heap.
I have now a language server running for dlang and ocaml on the
neovim editor.
I'll post here the config init.vim for someone who might be
interested.
```
call plug#begin()
Plug 'https://github.com/vim-airline/vim-airline.git'
Plug 'https://github.com/preservim/nerdtree.git'
Plug 'https://githu
Is there a link to a webpage with some dlang exercises in order
to see if i master the language, from simple to diffucult ?
Some keywords are overloaded and have different meaning when used
in a different place.
Also some syntactic-sugar is way to much meaning too many
different ways to do the same thing. I would prefer one way which
is advised.
Note, It's not i'm against GC. But my preference is to use
builtin types and libraries if possible,
But at the same time be able to be sure memory is given free when
a variable is going out of scope.
It seems not easy to combine the two with a GC which does his
best effort but as he likes or not
Error: array literal in @nogc function test.myfun may cause a GC
allocation
@nogc void myfun(){
scope int[] i=[1,2,3];
}//myfun
May is a fuzzy word...
I have not tested yet but i found two interesting links,
https://github.com/Pure-D/serve-d/blob/master/editor-vim.md
https://github.com/neoclide/coc.nvim
In a perfect world there would be someone uploading a youtube
video how to implement
neovim with a dlang language-server.
With function-completions-help where hints are given about the
functions and libraries.
If anyone could do this , this would be nice to have.
PS :
I use
```
ldc2 --gcc=cc ,
cc -v : clang version 11.0.1
```
Can someone provide a simple/very simple reference counting or
refcounted example i can understand. Thanks.
On Monday, 25 April 2022 at 14:25:17 UTC, H. S. Teoh wrote:
On Mon, Apr 25, 2022 at 01:28:01PM +, Alain De Vos via
Digitalmars-d-learn wrote:
Could thc or hboehm provide solutions ?
In general, GC (of any kind) does not (and cannot) guarantee
the order
objects will be collected in. So in
Indeed code below works,
```
import std.stdio: write,writeln;
class Node {
int data;
Node next;
}
class List {
Node node=null;
this(int[] AR){foreach(i ; AR)pushfront(i);}
void pushfront(int data) {
Node newnode=new Node();
Not really an answer but this works,
```
struct Foo {
string s;
this(string s) { this.s = s; }
}
void main(){
Foo foo = "a";
Foo[] foos;
foos ~=foo;
}%
```
Could thc or hboehm provide solutions ?
GC-allocated objects are run (when they are run). If you need
deterministic destruction e.g. for resource management, do not
use GC.
Descend destroy and free functions should return something.
"destroy" should return if the destructor was called successfully.
"free" should return the exact numb
Note, heap object i is not an instance of the class C
Ali, thanks for the answer but i rephrase my question.
How to destroy,free , for garbage-collection-cycle in the
destructor of this code :
```
import std.stdio: writeln;
class C{
int[] i=null;
this(){
writeln("Allocate heap");
i=new int[1];
This program works ok, (but List is no Range)
```
class Node {
int data;
Node next;
}
class List {
Node node=null;
this(int[] AR){foreach(i ; AR)pushfront(i);}
bool empty() const {return !node;}
void popFront() {node=node.next;}
float front
On Monday, 25 April 2022 at 05:17:28 UTC, Salih Dincer wrote:
On Monday, 25 April 2022 at 02:19:46 UTC, Ali Çehreli wrote:
This type violates a fundamental rule: Containers and ranges
are separate concepts. Your List is a container, not a range.
I changed your code by moving the range functio
```
void main(){dprintme("Hello\n");}
}
```
I'm currenlty experimenting about binding to C.
I have :
C-library:
mylib.h:
```
void libprintme(char *s);
```
mylib.c:
```
#include
#include "mylib.h"
void libprintme(char *s){printf("%s",s);}
```
main.d:
```
extern(C) @nogc nothrow {
void libprintme(char *s);
alias pprintme=void
On Saturday, 23 April 2022 at 10:46:42 UTC, Stanislav Blinov
wrote:
On Saturday, 23 April 2022 at 03:41:17 UTC, Alain De Vos wrote:
Feel free to elaborate.
Variables declared at module scope, and static variables in
function/aggregate scopes, unless also annotated as `shared` or
`__gshared`
On Saturday, 23 April 2022 at 04:52:39 UTC, Alain De Vos wrote:
On Saturday, 23 April 2022 at 03:41:17 UTC, Alain De Vos wrote:
I wrote a simple test program:
```
import std.stdio:writefln;
[...]
BBB: is probably the data-segment.
Remains AAA ?
Could AAA be the bss-segment ?
On Saturday, 23 April 2022 at 03:41:17 UTC, Alain De Vos wrote:
I wrote a simple test program:
```
import std.stdio:writefln;
[...]
BBB: is probably the data-segment.
Remains AAA ?
I wrote a simple test program:
```
import std.stdio:writefln;
int [] GLV=[1,2];
int [2] GLF=[1,2];
static int [] GSLV=[1,2];
static int [2] GSLF=[1,2];
void main(){
writefln("-");
writefln("GLV:address :%12x:AAA",&GLV);
writefln("GLF:address :%12x:AAA",&GLF);
writefln("GSLV:address:
I don't know when to use a static assert and when to use a unit
test ?
On Thursday, 21 April 2022 at 06:57:41 UTC, drug wrote:
On 21.04.2022 08:49, Alain De Vos wrote:
Following program:
```
import std.stdio;
void main() @trusted
{
int *p=null;
void myfun(){
int x=2;
p=&x;
writeln(p);
writeln(x);
}
myfun();
*p=16;
writeln(p);
writeln(*p);
}
``
Following program:
```
import std.stdio;
void main() @trusted
{
int *p=null;
void myfun(){
int x=2;
p=&x;
writeln(p);
writeln(x);
}
myfun();
*p=16;
writeln(p);
writeln(*p);
}
```
outputs :
7FFFDFAC
2
7FFFDFAC
32767
I don't understand why. Would it be pos
On Thursday, 21 April 2022 at 04:36:13 UTC, Salih Dincer wrote:
On Thursday, 21 April 2022 at 03:41:24 UTC, Ali Çehreli wrote:
On 4/20/22 19:11, Alain De Vos wrote:
> Maybe there are multiple solutions ?
Indeed. :)
I have a Range struct here:
http://ddili.org/ders/d.en/ranges.html#ix_rang
Following java program creates an infinite fibonacci sequence
(stream) an takes the first 42 values of it.
import java.util.function.UnaryOperator;
import java.util.stream.IntStream;
import java.util.stream.Stream;
public class test3 {
public static void main(String[] args) {
int b
On Wednesday, 20 April 2022 at 18:04:13 UTC, Alain De Vos wrote:
When compiling a .d file i don't see line numbers on which the
error occurs which is quite annoying.
The line i use to compile is :
ldc2 --gcc=cc --vcolumns --oq --dip1000 --dip25
--safe-stack-layout --boundscheck=on --D --g --w -
When compiling a .d file i don't see line numbers on which the
error occurs which is quite annoying.
The line i use to compile is :
ldc2 --gcc=cc --vcolumns --oq --dip1000 --dip25
--safe-stack-layout --boundscheck=on --D --g --w --de --d-debug
`find . -name \*.d -print`
Even:
lcd2 test.d produ
Dlang includes some good ideas.
But dub pulls in so much stuff. Too much for me.
I like things which are clean,lean,little,small.
But when i use dub it links with so many libraries.
Are they really needed ?
And how do you compare to pythons pip.
Feel free to elaborate.
I disabled 32bit code maybe this created the following error
while building dub :
[00:02:18]
===
[00:02:18] ===>
[00:02:18] ===> Configuring for dub-1.14.0
[00:02:23]
=
What i don't like about dub is that is does not check which
software is installed on the host.
Currentlu tck86 is installed on the host including header files &
shared libraries.
But dub says let me just download my own personal version and i
will compile it in your home directory
/home/myuser/
A simple example, dub package dpq2 pulls in,
money,vide-d,stdx-allocator,derelict-pq,derelict-util
This all for a handfull of C-functions.
A simple and small wrapper around for instance the C-library
libpq should be part of the language itself and should not pull
in more than libpq itself.
Is there a security review for dub packages ?
Dub has two big problems.
1. Unmaintained dub stuff.
2. Let's say you need bindings to postgresql library and you will
see dub pulling in numerous of libraries, which have nothing at
all to do with postgresql.
More like a framework stuff. This creates unneeded complexity,
bloatware, dependency
As an example i show this.
https://docs.python.org/3/library/json.html
But that is more what i look for.
With good select operators i can extract the data i need for
instance:
select measurement->'room.temperature' from mytable;
Now how to process that further as json object ? or jsonb object
in dlang ?
When I read a record out of the database I receive a jsonb
datatatype as a string.
How do I convert this string into a json object and parse and
manipulate it?
On Tuesday, 29 June 2021 at 20:27:15 UTC, Alain De Vos wrote:
On Tuesday, 29 June 2021 at 18:25:52 UTC, someone wrote:
On Tuesday, 29 June 2021 at 17:56:54 UTC, neuranuz wrote:
You could also try to find some ready to use bindings to
PostgreSQL on code.dlang.org.
Can you elaborate why you we
On Tuesday, 29 June 2021 at 18:25:52 UTC, someone wrote:
On Tuesday, 29 June 2021 at 17:56:54 UTC, neuranuz wrote:
You could also try to find some ready to use bindings to
PostgreSQL on code.dlang.org.
Can you elaborate why you went your own way coding your own
bindings to pglib instead of u
How to execute a random postgresql-query ?
With random i mean execute any string as known by postgresql.
void myexecutefunction(string string_to_execute){
// Some code to Execute postgre-sq-string
}
...
void main(){
myexecutefunction("CREATE DATABASE test");
myexecutefunction("CREATE USER test
Normally computers are deterministic and same input produces same
output. There is however theory on neural network stability and
it can be tuned.
I see the same error.
Dub is probably not much of a help :)
```
import std.stdio;
void main(){
auto a=new int[][] (0,0);
a~=[1,2];
a~=[3,4];
auto b= a.dup;
a[0]=[5,6];
a[1][1]=7;
writeln(b);
}
```
Program above outputs [[1, 2], [3, 7]]
Which means a[1][1] and b[1][1] point to the same memory location.
But a[0] occupies a different memory location as b[0].
One additional toolkit, fltk,
https://www.fltk.org/
If you have a compiler you can go.
1 - 100 of 204 matches
Mail list logo