| Thread overview | |||||||
|---|---|---|---|---|---|---|---|
|
November 04, 2014 Library inheritance | ||||
|---|---|---|---|---|
| ||||
Hi, just wondering if it's possible, due to the lag of header files, to inherit from some class that exists within a library, that has been written in D? How did you solve that? Thanks in advance. | ||||
November 04, 2014 Re: Library inheritance | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Felix | A library may provide header files for this, or you can just use the source code itself to import and inherit from. | |||
November 05, 2014 Re: Library inheritance | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Tuesday, 4 November 2014 at 15:27:33 UTC, Adam D. Ruppe wrote:
> A library may provide header files for this, or you can just use the source code itself to import and inherit from.
Okay, but that would mean to have the source available. Though
for me it seems like D is attempting to get rid of header files.
But when dealing with, lets say, some D compiled library there
seems to be now way to accomplish something like inheriting as
ELF doesn't provide you with the necessary data.
| |||
November 05, 2014 Re: Library inheritance | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Felix | On Wednesday, 5 November 2014 at 23:04:00 UTC, Felix wrote:
> On Tuesday, 4 November 2014 at 15:27:33 UTC, Adam D. Ruppe wrote:
>> A library may provide header files for this, or you can just use the source code itself to import and inherit from.
>
> Okay, but that would mean to have the source available.
You can still use a version of the source code without any of the function bodies (usually ending in .di). Same as in C++, more or less.
David
| |||
November 06, 2014 Re: Library inheritance | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Felix | On Tuesday, 4 November 2014 at 15:03:08 UTC, Felix wrote:
> Hi,
> just wondering if it's possible, due to the lag of header files, to inherit from some class that exists within a library, that has been written in D?
>
> How did you solve that?
>
> Thanks in advance.
You can run the compiler to create library and header (.di) files. Anything that requires compile-time execution, like templates, will remain in the .di. Anything that can be compiled as-is, will go in the library and just be represented as a function/method declaration in the .di file.
So, basically, the same as C++ except you don't have to manually write your own header files.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply