dub: how to reference a compiled package
Chris Wright via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Feb 25 08:45:46 PST 2016
On Thu, 25 Feb 2016 12:15:42 +0000, mahdi wrote:
> Hi,
>
> Suppose I have a package `mypack` in `~/mypack`. I run `dub` command on
> this package and have the compiled `mypack` file (OS is Linux).
>
> Now I am working on my project. I know how to use the source-code of
> `mypack` package in the project but what if I only have the compiled
> binary? How can I reference and use the modules of the compiled
> `mypack`?
>
> (I looked into the DUB homepage and it's Getting Started page but could
> not find anything).
First thing, you need D interface files. See:
https://dlang.org/dmd-linux.html#interface-files
Note that D interface files still require you to include the full body of
anything in a template, so you might have to modify your code somewhat
for improved secrecy.
Copy the *.di files and binaries into another dub project and add a
postBuildCommand to copy that binary to the output location.
I think that will work. dub might complain that it doesn't have any
source files, in which case you'll have to provide at least one D file
for it to compile, but that can be empty.
More information about the Digitalmars-d-learn
mailing list