D for sciencetific scripting / rapid protoryping

Arun Chandrasekaran aruncxy at gmail.com
Tue Oct 22 07:51:16 UTC 2019


On Tuesday, 22 October 2019 at 07:40:01 UTC, Prokop Hapala wrote:
> On Tuesday, 22 October 2019 at 07:23:46 UTC, Daniel Kozak wrote:
>> On Tue, Oct 22, 2019 at 8:00 AM Prokop Hapala via 
>> Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:
>>>
>>> I'm examining the possibility to move from Python+C/C++ to D 
>>> or
>>> Python+D. I read
>>> (https://wiki.dlang.org/Programming_in_D_for_Python_Programmers)
>>> and
>>> (https://jackstouffer.com/blog/nd_slice.html), where is 
>>> mentioned
>>> PyD, Mir-algorithm, all seems very promising. But I did not 
>>> test
>>> it yet.
>>  >...
>>
>> You should try to use https://github.com/BindBC/bindbc-opengl 
>> and
>> https://github.com/BindBC/bindbc-sdl. There seems to be an 
>> issue with
>> derelict packages (mainly with the gl3 one)
>> And as far as I know derelict should be replaced by bindbc 
>> anyway in future.
>>
>> And if you plan to have *.so libs you should add "targetType" 
>> : "dynamicLibrary", to you dub.json
>
> OK, thanks. That is useful to know. But just to not turn the 
> topic elsewhere I should make clear that:
>
> 1) I'm not speaking about OpenGL and SDL specifically (that was 
> just small example which I tried first)
>
> 2) I'm more concerned about how to D compiler links 
> dependencies when it compiles simple .d program (with lot of 
> dependencies).
>
> I think if I can make it link everything dynamically, It would 
> considerably reduce both size of binary target (whether it is 
> executable or .so) and compilation speed (since it would not 
> re-compile dependencies).
>
> What I want is to recompile and run quite large 
> programs/projects composed composed of many little 
> sub-programs/sub-libraries from Python+D in fast cycles (<< 1 
> second), because that would make debugging workflow much more 
> pleasant and efficient (in comparison to Python+C/C++ or Julia).

If you are building individual files, use ldc2 with 
--link-defaultlib-shared flag:

arun at home-pc:/tmp$ cat a.d
void main() { import std; writeln("Hai"); }
arun at home-pc:/tmp$ ldc2 a.d
arun at home-pc:/tmp$ ldd a
         linux-vdso.so.1 (0x00007fff6395b000)
         libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 
(0x00007f1ec91ea000)
         libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 
(0x00007f1ec91c7000)
         libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 
(0x00007f1ec9078000)
         libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 
(0x00007f1ec905e000)
         libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 
(0x00007f1ec8e6d000)
         /lib64/ld-linux-x86-64.so.2 (0x00007f1ec92c4000)
arun at home-pc:/tmp$ ldc2 a.d --link-defaultlib-shared
arun at home-pc:/tmp$ ldd a
         linux-vdso.so.1 (0x00007ffcbda7f000)
         libphobos2-ldc-shared.so.88 => 
/home/arun/.bin/ldc2-1.18.0-linux-x86_64/bin/../lib/libphobos2-ldc-shared.so.88 (0x00007f1b57be8000)
         libdruntime-ldc-shared.so.88 => 
/home/arun/.bin/ldc2-1.18.0-linux-x86_64/bin/../lib/libdruntime-ldc-shared.so.88 (0x00007f1b57abc000)
         libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 
(0x00007f1b57a84000)
         libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 
(0x00007f1b57893000)
         libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 
(0x00007f1b57744000)
         libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 
(0x00007f1b57721000)
         librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 
(0x00007f1b57714000)
         libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 
(0x00007f1b5770e000)
         /lib64/ld-linux-x86-64.so.2 (0x00007f1b58067000)
arun at home-pc:/tmp$


More information about the Digitalmars-d-learn mailing list