← Back to team overview

drizzle-discuss team mailing list archive

Re: Drizzle on MS windows

 

On 07/29/2010 03:04 PM, Trond Norbye wrote:
> 
> On 29. juli 2010, at 23.48, Monty Taylor wrote:
> 
>> On 07/29/2010 02:12 PM, Stewart Smith wrote:
>>> On Thu, 29 Jul 2010 13:46:46 -0700, Monty Taylor
>>> <mordred@xxxxxxxxxxxx> wrote:
>>>> I did not do anything with restructuring in this way. I'd put a
>>>> flag around it ( like if (wsa_initted) ) though rather than a
>>>> library init function ... if we can avoid requiring library
>>>> users needing to call "drizzle_lib_init" I'd really like to.
>>> 
>>> You may be able to do a constructor for the library that's
>>> automatically called on the equiv of dlopen()
>>> 
>>> (I do this in libeatmydata for example)
>>> 
>> 
>> Yes - but it's not even remotely portable (I did some research on
>> this a while ago.
>> 
>> You can do this in certain environments for certain usage
>> patterns... but sadly it's wonky enough that unless it's something
>> like libeatmydata, it's probably just not safe. (libdrizzle is
>> gonna get sucked in by all sorts of stuff)
>> 
>> In this case, doing the flag check should be _really_ easy.
> 
> Isn't this something the application that use libdrizzle should do,
> and not something that the library should do automatically? Other
> parts of the application may also use sockets....

Ok. I did some reading.

It's perfectly fine to call it more than once. It is, in fact, NOT ok to
call it from DllMain, so the auto-run bit would be extra bad.

So I'm going to vote for leaving this how Jobin had it. If the calling
app needs other sockets, they can call WSAStartup and be fine. If the
calling app just wants to talk to Drizzle, they can just use the library
and also be fine.

Done.



Follow ups

References