www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - misc questions about a DUB package

reply DanielG <simpletangent gmail.com> writes:
I have some D-wrapped C libraries I'm considering publishing to 
DUB, mainly for my own use but also for anybody else who might 
benefit. I've never done this before so I have some questions:

- Should there be any obvious relationship between the DUB 
package version and the version of the C library? What are the 
best practices for connecting the two, if at all?

- I'm very much about the "full fat" D experience, so I presently 
have no intention of designing my D wrappers for 
betterC/the-runtime-is-lava usage. That being the case, is there 
any compelling reason to avoid initializing the C library in a 
'shared static this()' method? (ie automatically)
Jul 14 2020
parent reply 9il <ilyayaroshenko gmail.com> writes:
On Tuesday, 14 July 2020 at 20:56:06 UTC, DanielG wrote:
 I have some D-wrapped C libraries I'm considering publishing to 
 DUB, mainly for my own use but also for anybody else who might 
 benefit. I've never done this before so I have some questions:

 - Should there be any obvious relationship between the DUB 
 package version and the version of the C library? What are the 
 best practices for connecting the two, if at all?
No. Usually, a DUB package supports a range of C library version or just a fixes set of C API. The version behavior of the dub package is up to you. Usually, D API changes more frequently than the underlying C library.
 - I'm very much about the "full fat" D experience, so I 
 presently have no intention of designing my D wrappers for 
 betterC/the-runtime-is-lava usage. That being the case, is 
 there any compelling reason to avoid initializing the C library 
 in a 'shared static this()' method? (ie automatically)
Yes. For a large project and services, it may be required to initialize shared a library with a function call instead of at startup. Furthermore, missing dependency may not be a fatal issue for service. In other hand, it all depends on your usage case.
Jul 14 2020
next sibling parent DanielG <simpletangent gmail.com> writes:
Thank you.
Jul 14 2020
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2020-07-15 04:20, 9il wrote:

 No. Usually, a DUB package supports a range of C library version or just 
 a fixes set of C API. The version behavior of the dub package is up to 
 you. Usually, D API changes more frequently than the underlying C library.
If you support a specific version of the C API, I recommend adding the version of the C library as metadata: 0.0.1+5.3 In the above example "0.0.1" would be the version of the Dub package. "5.3" would be the version of the C API. The plus sign and anything after is ignored by Dub. See semantic versioning docs for more information: https://semver.org -- /Jacob Carlborg
Jul 15 2020
parent DanielG <simpletangent gmail.com> writes:
On Wednesday, 15 July 2020 at 11:49:09 UTC, Jacob Carlborg wrote:
 The plus sign and anything after is ignored by Dub.
Good to know, thank you.
Jul 15 2020