Re: How to deploy single exe application (?)

2021-11-29 Thread forkit via Digitalmars-d-learn

On Monday, 29 November 2021 at 14:58:07 UTC, Willem wrote:


Thanks again for all the responses. For now -- I am simply 
adding the DLL to the EXE and writing it out to the working 
directory.   Not elegant - but it does work.




"Programmers are not to be measured by their ingenuity and their 
logic but by the completeness of their case analysis." - Alan 
Perlis.


Re: Debugging D code with GDB

2021-11-29 Thread Luís Ferreira via Digitalmars-d-learn
On Sun, 2021-11-28 at 21:59 +, Iain Buclaw via Digitalmars-d-learn
wrote:
> On Saturday, 27 November 2021 at 14:17:11 UTC, Eduard Staniloiu 
> wrote:
> > Hello,
> > 
> > I'm trying to use `gdb` to debug D binaries, but I'm having 
> > trouble accessing the methods of a struct or class. It seems 
> > that `gdb` doesn't see them.
> > 
> > Given the following simple example
> > ```
> > // test.d
> > struct S
> > {
> >     int x;
> > 
> >     void myPrint() { writefln("x is %s\n", x); }
> > }
> > 
> > void main(string[] args)
> > {
> >     S s;
> > }
> > ```
> > Compile the source file with debug simbols (`dmd -g test.d 
> > -of=test`) and open the binary with gdb (`gdb test`) and run 
> > the following
> > 
> > ```
> > > break _Dmain # break at D entry point
> > > run
> > > ptype s
> > type = struct test.S {
> >     int x;
> > }
> > > print s.myPrint()
> > Structure has no component named myPrint.
> > ```
> > 
> > As you can see, when I try to access the `myPrint()` method I 
> > get the error
> > "Structure has no component named myPrint."
> > 
> 
> DMD doesn't emit this information. GDB can't work miracles when 
> the compiler isn't pulling its own weight.

I confirm this is an issue with DMD. I filed a bug in the issue
tracker, in case you want to follow:
https://issues.dlang.org/show_bug.cgi?id=22551

Anyway, DMD exports the symbol, it should work if you do something like
`myPrint()`, but I think there is another problem on calling it, due
to defective calling convention on both DMD and LDC implementations.

LDC exports the symbol correctly, although.

-- 
Sincerely,
Luís Ferreira @ lsferreira.net



signature.asc
Description: This is a digitally signed message part


Re: How to deploy single exe application (?)

2021-11-29 Thread Willem via Digitalmars-d-learn

On Monday, 29 November 2021 at 07:29:35 UTC, Mike Parker wrote:


`DerelictSDL2.load()` cannot load curl. It is not a generic dll 
loader. It only loads SDL and doesn't know anything about curl 
or any other library.


In order to dynamically load curl like this, you need a binding 
that supports it, i.e., a binding that declares the curl API as 
function pointers and knows how to load them from the DLL.


Also, DerelictSDL2 is no longer maintained. Please use 
bindbc-sdl for new projects:


http://bindbc-sdl.dub.pm/


Thanks again for all the responses. For now -- I am simply adding 
the DLL to the EXE and writing it out to the working directory.   
Not elegant - but it does work.


```
import std.stdio;
import std.file;

ubyte[] curlBytes = cast(ubyte[]) import("libcurl.dll");

void main(string[] args)
{
std.file.write("libcurl.dll", curlBytes);

// test curl
import std.net.curl;
auto content = get("https://httpbin.org/get;);
writeln(content);
writeln("..DONE");
}

```


Re: Payload Details with std.net.curl:post

2021-11-29 Thread ikod via Digitalmars-d-learn

On Monday, 29 November 2021 at 01:49:37 UTC, Kyle Ingraham wrote:

On Sunday, 28 November 2021 at 07:27:35 UTC, ikod wrote:
On Sunday, 28 November 2021 at 01:06:45 UTC, Kyle Ingraham 
wrote:

On Saturday, 27 November 2021 at 22:18:48 UTC, ikod wrote:


Hi Kyle!

I found https://pki.goog/repository/ which has links to all 
certificates relevant to Google URLs. I worked my way down the 
certificate chain and the call that worked was:


```D
auto rq = Request();
rq.sslSetCaCert(r"gtsr1.pem");
```



Nice to hear that you solved this problem! Openssl under windows 
sometimes require
extra efforts. I tried to add support for native windows 
SecureChannel API in `requests`, but got stuck somewhere in the 
middle of the process.