Is it feasible to slowly rewrite a C++ codebase in D?

jmh530 john.michael.hall at gmail.com
Wed Jun 20 19:57:55 UTC 2018


On Wednesday, 20 June 2018 at 18:47:10 UTC, Jordi Gutiérrez 
Hermoso wrote:
> I'm specifically thinking of the GNU Octave codebase:
>
> http://hg.savannah.gnu.org/hgweb/octave/file/@
>
> It's a fairly old and complicated C++ codebase. I would like to 
> see if I could slowly introduce some D in it, anywhere.
>
> Now, as I understand it, I would need to begin with making 
> `main` a D function, because D needs to initialise the runtime. 
> Is this correct?
>
> Another possibility might be in dlopen'able functions. 
> Currently Octave uses so-called oct functions, which are 
> nothing more than C++ object code that is dynamically loaded by 
> the interpreter at runtime. They are compiled to the Octave C++ 
> API, but we also have a Matlab-compatible C API that perhaps 
> could be more amenable for D-ification.
>
> What are your ideas?

I'm a little confused...you mean like embedr [1, 2] and pyd [3], 
but for Octave and Matlab? The idea would that you could write 
functions in D and call them in Matlab/Octave, and vice-versa. I 
suppose that. I'm not sure adding D to the GNU Octave code base 
is necessarily the biggest value add...

There was an old forum post years ago on the subject [4], but the 
link to the repository is dead.

[1] https://bitbucket.org/bachmeil/embedr
[2] https://github.com/bdilday/embedr
[3] https://code.dlang.org/packages/pyd
[4] 
https://forum.dlang.org/thread/op.vhjavyoc3ncmek@enigma.fem.tu-ilmenau.de


More information about the Digitalmars-d-learn mailing list