Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 12, 2008 Dynamic Libaries in D | ||||
---|---|---|---|---|
| ||||
Can someone help me with dynamic libraries in d. I've seen this http://www.digitalmars.com/d/2.0/dll.html as an example of windows dll and a similar example of using tango here http://dsource.org/projects/tango/wiki/TutDLL but both say multiple threads not supported. How can I make a dll in d that supports multi threads. I would also like to make linux modules so how can I do the initialization and finalization for those or can the compiler do it for me without coding it? |
October 12, 2008 Re: Dynamic Libaries in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tim M | Tim M wrote: > Can someone help me with dynamic libraries in d. I've seen this http://www.digitalmars.com/d/2.0/dll.html as an example of windows dll and a similar example of using tango here http://dsource.org/projects/tango/wiki/TutDLL but both say multiple threads not supported. How can I make a dll in d that supports multi threads. > > I would also like to make linux modules so how can I do the initialization and finalization for those or can the compiler do it for me without coding it? Unless you really need DLL's, and not only dynamic libraries - look into DDL. http://www.dsource.org/projects/ddl -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango |
October 12, 2008 Re: Dynamic Libaries in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | Lars Ivar Igesund schrieb:
> Tim M wrote:
>
>> Can someone help me with dynamic libraries in d. I've seen this
>> http://www.digitalmars.com/d/2.0/dll.html as an example of windows dll and
>> a similar example of using tango here
>> http://dsource.org/projects/tango/wiki/TutDLL but both say multiple
>> threads not supported. How can I make a dll in d that supports multi
>> threads.
>>
>> I would also like to make linux modules so how can I do the initialization
>> and finalization for those or can the compiler do it for me without coding
>> it?
>
> Unless you really need DLL's, and not only dynamic libraries - look into
> DDL.
>
> http://www.dsource.org/projects/ddl
>
I can't agree with Lars "Snowman" Igesund. DDL is not ready for production use. (Especially related to ix based systems)
Windows DMD created DLL's are almost un-useable.
No classes, no threads, no exeption handling.
I am using DMD DLLs nevertheless (simply by creating wrappers functions around classes), but in general I would like to say:
Using DMD shared libs is like bying tools from Shitty Butthead very LTD
and I am afraid the situation will not change for quit a while.
Bjoern
|
October 12, 2008 Re: Dynamic Libaries in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to BLS | BLS wrote: > Lars Ivar Igesund schrieb: >> Tim M wrote: >> >>> Can someone help me with dynamic libraries in d. I've seen this http://www.digitalmars.com/d/2.0/dll.html as an example of windows dll and a similar example of using tango here http://dsource.org/projects/tango/wiki/TutDLL but both say multiple threads not supported. How can I make a dll in d that supports multi threads. >>> >>> I would also like to make linux modules so how can I do the initialization and finalization for those or can the compiler do it for me without coding it? >> >> Unless you really need DLL's, and not only dynamic libraries - look into DDL. >> >> http://www.dsource.org/projects/ddl >> > I can't agree with Lars "Snowman" Igesund. DDL is not ready for production use. (Especially related to ix based systems) He was clearly talking about Windows dll's, and they will _never_ be production ready in D, whereas DDL is. In this particular case, it seems that *nix performance is irrelevant. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango |
October 12, 2008 Re: Dynamic Libaries in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | Lars Ivar Igesund schrieb:
> BLS wrote:
>
>> Lars Ivar Igesund schrieb:
>>> Tim M wrote:
>>>
>>>> Can someone help me with dynamic libraries in d. I've seen this
>>>> http://www.digitalmars.com/d/2.0/dll.html as an example of windows dll
>>>> and a similar example of using tango here
>>>> http://dsource.org/projects/tango/wiki/TutDLL but both say multiple
>>>> threads not supported. How can I make a dll in d that supports multi
>>>> threads.
>>>>
>>>> I would also like to make linux modules so how can I do the
>>>> initialization and finalization for those or can the compiler do it for
>>>> me without coding it?
>>> Unless you really need DLL's, and not only dynamic libraries - look into
>>> DDL.
>>>
>>> http://www.dsource.org/projects/ddl
>>>
>> I can't agree with Lars "Snowman" Igesund. DDL is not ready for
>> production use. (Especially related to ix based systems)
>
> He was clearly talking about Windows dll's, and they will _never_ be
> production ready in D, whereas DDL is. In this particular case, it seems
> that *nix performance is irrelevant.
>
Hi Lars,
Quote Tim M.
I would also like to make linux modules so how can I do the initialization and finalization for those ...
End Quote.
However, I use D DLLs by using the extern windows interface and the current behaviour is almost okay for me. But in case that I need extern D {} in order to create plugins for my D application .... you know.
Borland's C++ compiler has support for that kind of shared libraries, so it is reasonable to ask : Why D has not.
Kind regards, bjoen
PS: will _never_ be production ready.. Why ?
|
October 12, 2008 Re: Dynamic Libaries in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to BLS | BLS wrote: > Kind regards, bjoen > PS: will _never_ be production ready.. Why ? There are several reasons, most of which should be explained on the DDL pages. It has to do with exception handling, sharing of symbols, etc. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango |
October 13, 2008 Re: Dynamic Libaries in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | DDL looks nice but can I make DDLs in DLL format that can be loaded and linked to an existing host application. I don't have access to the source code for the host app. |
October 13, 2008 Re: Dynamic Libaries in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tim M | If your reason for writing a DLL is to interface into a 3rd party applpication. Which is the reason we are using DLLs in D then chances are the extern(Windows) or extern(C) style functions are what you want anyway. You can use D features behind your C style interfaces. We have successfully done this with implementing In process COM servers in D. If you want to just have nice dynamically loaded modules in your own native D app then from what I've seen DDL will be the right way to go when it's ready. If you want your application to be able to be extended by others, then you are back to DLLs since most people extending your application will probably not be using D. "Tim M" <a@b.com> wrote in message news:op.uixsjpl3jdp9fl@tim-laptop.ssiltd.home... > DDL looks nice but can I make DDLs in DLL format that can be loaded and linked to an existing host application. I don't have access to the source code for the host app. |
October 13, 2008 Re: Dynamic Libaries in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Michael Robellard | So do I just have to use C/C++ and is there any plans / current projects that this may change in future?
On Tue, 14 Oct 2008 01:26:43 +1300, Michael Robellard <mrobellard@ag.com> wrote:
> If your reason for writing a DLL is to interface into a 3rd party
> applpication. Which is the reason we are using DLLs in D then chances are
> the extern(Windows) or extern(C) style functions are what you want anyway.
> You can use D features behind your C style interfaces. We have successfully
> done this with implementing In process COM servers in D. If you want to just
> have nice dynamically loaded modules in your own native D app then from what
> I've seen DDL will be the right way to go when it's ready. If you want your
> application to be able to be extended by others, then you are back to DLLs
> since most people extending your application will probably not be using D.
>
>
> "Tim M" <a@b.com> wrote in message
> news:op.uixsjpl3jdp9fl@tim-laptop.ssiltd.home...
>> DDL looks nice but can I make DDLs in DLL format that can be loaded and
>> linked to an existing host application. I don't have access to the source
>> code for the host app.
>
>
|
October 13, 2008 Re: Dynamic Libaries in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tim M | Tim M wrote:
> So do I just have to use C/C++ and is there any plans / current projects that this may change in future?
No, you just have to do this:
extern (Windows)
{
// The application calls this
void someDllFunc ()
{
// regular D code here
}
}
void someNonDllFunc ()
{
// The application doesn't see this.
}
extern (Windows) tells the compiler to disguise the functions so they look like regular C functions in the resulting object file. It doesn't change the meaning of any code inside.
|
Copyright © 1999-2021 by the D Language Foundation