How to setup mono-D for shared libraries?

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 24 21:32:39 PDT 2015


On 25/09/15 9:58 AM, Jacob wrote:
> On Wednesday, 23 September 2015 at 04:34:45 UTC, Rikki Cattermole wrote:
>> On 23/09/15 8:20 AM, Jacob wrote:
>>> How do I setup mono-D for creating shared libraries and including them
>>> into other projects? When I drag the .d files to create the library
>>> from, which is not my own, I get undefined references. I have the lib
>>> files, which are a bunch of separate libs, that I want to include into
>>> one big lib. Once that's done I want to include that lib into another
>>> project.
>>>
>>> I'd rather not modify si.ini. Are there any tutorials for getting
>>> started with Mono-D? (setup, not coding)
>>
>> Well you could go the route of dub, which configuration files can be
>> loaded directly into it as a project.
>
> To create the library, what do I do?
>
> 'dub init myLib'
>
> then delete app.d,
>
> and then add all the library.d files?
>
> Then what? Where do I tell it to find the .lib files without adding them
> to sc.ini?
>
> Do I just mess with dub.json to and add all the proper build options to
> get both the lib and the dependent apps working or are there other steps
> I'm missing?

"targetType": "dynamicLibrary"
http://code.dlang.org/package-format?lang=json#target-types

I would also recommend looking at sub packages.
http://code.dlang.org/package-format?lang=json#sub-packages
That'll make things a lot easier. To have both an executable and a 
shared library built from the same project directory :)


More information about the Digitalmars-d-learn mailing list