RE: Shared memory

new topic     » goto parent     » topic index » view thread      » older message » newer message

Derek Parnell wrote:
> 
> From: "Matt Lewis"
> > 
> > 
> > Derek Parnell wrote:
> > > 
> > > From: "Philip D." <philip1987 at hotmail.com>
> > > 
> > > > I really would like to do this because I want to make a 
> > > > program with the win32lib and have DLLs which can put 
> > > > controls on the window made with the program.  This currently 
> > > > can't be done because the DLL has to include a whole fresh 
> > > > set of win32lib variables.  (see topic: Referencing Control 
> > > > Ids in DLLs)  If I could share their memory, the DLL would 
> > > > know about the window created in the program.
> > > 
> > > Stop! Read my lips! You can't do this with win32lib. It is NOT 
> > > built for this. 
> > > 
> > > You can either place win32lib in your main program OR put it in 
> > > the DLL, but you can't do both and have it work how you want to.
> > 
> > Why does everyone say this is impossible?  
> 
> Because it is. The 'it' being to have two independant win32lib 
> libraries behave as if they were one - sharing the same variables 
> etc... I am not saying that you can't do Windows apps using a main 
> program and DLLs all written in Euphoria. Sure you can do that. But 
> NOT using win32lib in both. The original question wanted to create 
> Buttons using the DLL from a main window created in the main 
> program's win32lib. 

I guess we parsed the question differently.  I think the real point of 
his question was about integrating a dll with a win32lib app.  Of 
course, it isn't possible to have two copies of win32lib work together 
(although I suppose you could do some really ugly hacks using 
subClassControl).


> In the main program we would have something like ...
>    Win = create(Window, "title", 0, 0, 0, 400,300,0)
> 
> Now this give 'Win' the value 3, but sets up a whole mess of hidden 
> variables inside the win32lib.ew which is inside the main program. 
> 
> If we now do this in the DLL (by passing the value of 'Win')
> 
>    Btn = create(Button, "btn", Win, 5, 5, 20, 40, 0)
> 
> The value of Win (3) is not set up in the DLL's win32lib so it will 
> fail as a parent control. The button will not be created!
> 
> > The key is to set up some 
> > callback mechanism in your program for the dll to call the 
> > correct win32lib routines.  You'd need to figure out which 
> > routines you wanted to call from win32lib.  
> 
> Ahh...but which win32lib? The main program's copy or the DLL's copy?

Sorry, wasn't clear enough.  There would only be one win32lib: in the 
program.  You could also set it up so that the dll held the copy of 
win32lib, but I think that the idea is probably to add flexible 
modules--truly dynamic 'includes'?--so it really only makes sense to do 
it this way, since then you could have as many dll's as you like plugged 
into the single copy of win32lib.

<snip>

> You seem to be describing a way that a DLL can use the main 
> program's copy of win32lib. And I suspect you will be able to do 
> that, but that was not what was asked for.

Well, it wasn't the method asked for, but I think it's what he really 
wanted.

Matt Lewis

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu