llvm-d

Moritz Maxeiner moritz at ucworks.org
Mon Mar 18 08:41:37 PDT 2013


On Monday, 18 March 2013 at 14:51:00 UTC, Jens Mueller wrote:
> Moritz Maxeiner wrote:
>> On Monday, 18 March 2013 at 13:50:29 UTC, Jens Mueller wrote:
>> >I don't know how this is done on Windows. On Linux you just 
>> >set
>> >the
>> >LD_LIBRARY_PATH.
>> 
>> My problem with that is that it's a) not encapsulated inside 
>> the
>> program and b) OS dependent.
>
> Very true. Do you have a solution for this? I can add it to 
> ddl, if that
> is the right place to put it.

Well, it's more of a workaround than a solution:
The loading function (D) takes two arguments: The path and the 
file(name)
of the shared lib. If no filename is given, a ctfe generated one 
is used. The shared contructors calls this function with a path 
of "". That's about all I need for the LLVM shared lib; but if 
you're going to load a shared lib from a certain path which have 
dependencies in that certain path you'll need to additionally use 
SetDLLDirectoryA on windows (posix automatically looks in the 
directory a shared lib is loaded from afaik).
For source code you could look here:
https://github.com/Calrama/llvm-d/blob/master/llvm/c/all.d

>
>> >Probably. There are very few users for such a use case.
>> >But if you would use LLVM's plain C interface in D users who 
>> >have
>> >used
>> >the API in C will feel home. I mean why expose the LLVM C API 
>> >as
>> >an
>> >addition. It certainly does no harm.
>> 
>> The C API will keep being exposed, of course; all I meant was 
>> that
>> splitting them off might not be the best idea when they mostly 
>> exist
>> only to be used by the D API and the C API should not be used 
>> unless
>> you really want/have to.
>
> And by splitting you mean in different files, right?

No, the C API will rest in llvm/c/... (as it does right now) 
while the D API will rest in llvm/d/... (so the C API will be 
usable without the D API and can be compiled and linked in 
without it).
With "splitting" I meant putting them in another project entirely 
like llvm-d and (deimos)llvm.

>> >The process is usually pretty simple. But the documentation is
>> >lacking.
>> >There are several pieces floating around. I can try writing 
>> >one
>> >document
>> >and try to push it to the official web site.
>> 
>> That'd be great, thank you very much.
>> 
>> >Do as you like it. I do not think this is a bad approach.
>> 
>> I'll to that, then. I'm currently working on the D API, but 
>> I'll try
>> to get the copied deimos compatible project started in the next
>> couple of days.
>
> Sounds good. I'm going to write the documentation this evening.

Awesome, thanks.


More information about the Digitalmars-d-announce mailing list