Thread overview
Phobos as DLL - mostly
May 01, 2005
Burton Radons
May 01, 2005
Burton Radons
May 01, 2005
John Reimer
May 01, 2005
John Demme
May 01, 2005
John Reimer
May 01, 2005
Dejan Lekic
May 01, 2005
Burton Radons
May 01, 2005
John Reimer
May 01, 2005
Burton Radons
May 01, 2005
Okay folks I took the Phobos as DLL thing as far as the compiler let me.  Taking it any farther causes code to stop doing anything.  Doesn't call, doesn't write, I don't know what's wrong and I don't really feel like spending thirty hours in MSDN trying to figure it out.  What can't go into DLL right now is:

	internal/dmain2.d (obviously, since it holds the entry point)
	TypeInfo files
	regexp.d, outbuffer.d (Why???)
	stream.d (Might be something OS related, IO streams are still loopy because C defined them in as bizarre a manner as they could manage)
	internal/moduleinit.d (fairly obvious)
	object.d
        Dzlib.d

Everything else fits.  You can use this by dropping the library files in /dmd/lib and then stashing the DLL wherever you want.  The files are at:

http://members.shaw.ca/burton-radons/phobos_dll.zip (538kb)

I'll try to get a win32.mak together so that you can play at home but presently it uses digc.  All it really needs from digc is one of its many fantastic tools, the export listing function but I am a lazy man so expect a release in 2007 or so.
May 01, 2005
Burton Radons wrote:

> Everything else fits.  You can use this by dropping the library files in /dmd/lib and then stashing the DLL wherever you want.  The files are at:
> 
> http://members.shaw.ca/burton-radons/phobos_dll.zip (538kb)

Oops - also you must include "phobos_dll.lib" on any compiled program or it will be angry.  Hey cool, the linker just crashed!

Uh

Oh

Okay, if you don't have a "main" when compiling a program, instead of saying you're a jerk and here's some weird symbols you've never seen before that you need to fill out, it will say "Unexpected OPLINK Termination" and advise immediate airlift to the shielded nuclear bunkers before the bombs start falling.

Oh, and uncaught exceptions cause bad things to happen.  Or, uh, maybe not.  I'll have to look into it more closely tomorrow.
May 01, 2005
Burton Radons wrote:
> Burton Radons wrote:
> 
>> Everything else fits.  You can use this by dropping the library files in /dmd/lib and then stashing the DLL wherever you want.  The files are at:
>>
>> http://members.shaw.ca/burton-radons/phobos_dll.zip (538kb)
> 
> 
> Oops - also you must include "phobos_dll.lib" on any compiled program or it will be angry.  Hey cool, the linker just crashed!
> 
> Uh
> 
> Oh
> 
> Okay, if you don't have a "main" when compiling a program, instead of saying you're a jerk and here's some weird symbols you've never seen before that you need to fill out, it will say "Unexpected OPLINK Termination" and advise immediate airlift to the shielded nuclear bunkers before the bombs start falling.
> 
> Oh, and uncaught exceptions cause bad things to happen.  Or, uh, maybe not.  I'll have to look into it more closely tomorrow.


I'm surprised people aren't responding to this.  Isn't it what a lot of people were interested in... phobos as a dll?
May 01, 2005
Can that be compiled on Linux? :)

-- 
...........
Dejan Lekic
  http://dejan.lekic.org

May 01, 2005
On Sun, 2005-05-01 at 11:15 -0700, John Reimer wrote:
> Burton Radons wrote:
> > Burton Radons wrote:
> > 
> >> Everything else fits.  You can use this by dropping the library files in /dmd/lib and then stashing the DLL wherever you want.  The files are at:
> >>
> >> http://members.shaw.ca/burton-radons/phobos_dll.zip (538kb)
> > 
> > 
> > Oops - also you must include "phobos_dll.lib" on any compiled program or it will be angry.  Hey cool, the linker just crashed!
> > 
> > Uh
> > 
> > Oh
> > 
> > Okay, if you don't have a "main" when compiling a program, instead of saying you're a jerk and here's some weird symbols you've never seen before that you need to fill out, it will say "Unexpected OPLINK Termination" and advise immediate airlift to the shielded nuclear bunkers before the bombs start falling.
> > 
> > Oh, and uncaught exceptions cause bad things to happen.  Or, uh, maybe not.  I'll have to look into it more closely tomorrow.
> 
> 
> I'm surprised people aren't responding to this.  Isn't it what a lot of people were interested in... phobos as a dll?

I was interested in phobos as an SO, which I don't think can be done right now.

John Demme

May 01, 2005
John Demme wrote:
>>
>>
>>I'm surprised people aren't responding to this.  Isn't it what a lot of people were interested in... phobos as a dll?
> 
> 
> I was interested in phobos as an SO, which I don't think can be done
> right now.
> 
> John Demme
> 

Yes, the same here.  I'm still waiting for that.

-JJR
May 01, 2005
Dejan Lekic wrote:

> Can that be compiled on Linux? :)

Something analogous could certainly be done.  It's not like it took a great Windows guru with steely patience to do this; I only know enough about Windows internals to know that I don't want to know anything about Windows internals because it's a steaming pile and you'd spend years learning the specifics of how something was incorrectly designed.  It would be like becoming a master shipbuilder of ships which fall apart. But I digress.

If you start with a parallel .so and just move files one at a time from the .a over, you should be able to get as far or farther than I did.  It would also be good to have a better testsuite than I had to be sure that nothing goes wrong (which is probably less likely to happen in Linux than in Windows).  I don't think it's a complex task, it just requires going from the thought "hey Phobos should be in a shared library" to "hey I'm going to make Phobos into a shared library".  Someone could probably do it in under an hour.
May 01, 2005
Burton Radons wrote:
> Dejan Lekic wrote:
> 
>> Can that be compiled on Linux? :)
> 
> 
> Something analogous could certainly be done.  It's not like it took a great Windows guru with steely patience to do this; I only know enough about Windows internals to know that I don't want to know anything about Windows internals because it's a steaming pile and you'd spend years learning the specifics of how something was incorrectly designed.  It would be like becoming a master shipbuilder of ships which fall apart. But I digress.
> 
> If you start with a parallel .so and just move files one at a time from the .a over, you should be able to get as far or farther than I did.  It would also be good to have a better testsuite than I had to be sure that nothing goes wrong (which is probably less likely to happen in Linux than in Windows).  I don't think it's a complex task, it just requires going from the thought "hey Phobos should be in a shared library" to "hey I'm going to make Phobos into a shared library".  Someone could probably do it in under an hour.

Burton, how do you propose a linux shared library can be created if shared libraries aren't supported by the dmd compiler yet?  Is there a way? Perhaps by using gdc?

-JJR
May 01, 2005
John Reimer wrote:

> Burton Radons wrote:
> 
>> Dejan Lekic wrote:
>>
>>> Can that be compiled on Linux? :)
>>
>>
>>
>> Something analogous could certainly be done.  It's not like it took a great Windows guru with steely patience to do this; I only know enough about Windows internals to know that I don't want to know anything about Windows internals because it's a steaming pile and you'd spend years learning the specifics of how something was incorrectly designed.  It would be like becoming a master shipbuilder of ships which fall apart. But I digress.
>>
>> If you start with a parallel .so and just move files one at a time from the .a over, you should be able to get as far or farther than I did.  It would also be good to have a better testsuite than I had to be sure that nothing goes wrong (which is probably less likely to happen in Linux than in Windows).  I don't think it's a complex task, it just requires going from the thought "hey Phobos should be in a shared library" to "hey I'm going to make Phobos into a shared library".  Someone could probably do it in under an hour.
> 
> 
> Burton, how do you propose a linux shared library can be created if shared libraries aren't supported by the dmd compiler yet?  Is there a way? Perhaps by using gdc?

Ah, I didn't know that they weren't supported at all.  There's no way to hack around it - the object files themselves lack necessary functionality that can't be fixed with hacking?  Ignore my pep talk then, you're screwed.  ;)

I've updated the archive.  DLL instantiation problem was fixed.