1. Shared memory

Is there any way to share memory between 2 different euphoria programs?  
This would need to include variables and routines to serve my purposes.

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.

Thanks,
Phil

new topic     » topic index » view message » categorize

2. Re: Shared memory

----- Original Message ----- 
From: "Philip D." <philip1987 at hotmail.com>
To: <EUforum at topica.com>
Subject: Shared memory


> 
> 
> Is there any way to share memory between 2 different euphoria programs?  

Yes. But it is NOT trival. And by memory, we are talking about RAM and not
Euphoria's internal variables etc....

> This would need to include variables and routines to serve my purposes.

Sorry. Not possible.
 
> 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.

Sorry, but you'll have to find another way. And that will undoubtly use direct
API calls and not use anything that is inside win32lib.

-- 
Derek

new topic     » goto parent     » topic index » view message » categorize

3. Re: Shared memory

On 13 Dec 2003, at 11:28, Derek Parnell wrote:

> 
> 
> ----- Original Message ----- 
> From: "Philip D." <philip1987 at hotmail.com>
> To: <EUforum at topica.com>
> Subject: Shared memory
> 
> 
> > Is there any way to share memory between 2 different euphoria programs?  
> 
> Yes. But it is NOT trival. And by memory, we are talking about RAM and not
> Euphoria's internal variables etc....
> 
> > This would need to include variables and routines to serve my purposes.
> 
> Sorry. Not possible.

Hmmmmmm,,,, what about associated lists stored in the shared memory by 
using ****'s window server? Could shared routines be done the same way,, or 
the window server itself be the whole gui for Phillip's application?

Kat,
noes nest too notink abaot guis codde

new topic     » goto parent     » topic index » view message » categorize

4. Re: Shared memory

Philip D. wrote:
> Is there any way to share memory between 2 different euphoria programs?  

Yes. Search the file archive for:

     share memory

You'll find examples by Mario Steele, Jason Mirwald,
Jordah Ferguson and Elliott Sales de Andrade that
allow two separate Euphoria processes to
share memory, and even pass Euphoria data back and forth.

> This would need to include variables and routines to serve my purposes.
> 
> 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.

That sounds too complicated, especially since
DLLs can't share Win32Lib variables or even routine id's
with the main program.
However they can share machine addresses of Euphoria
routines, and in 2.4 you can call a Euphoria
routine given its call_back() address. Andrea Cini
uses this trick in EuWinGUI.

Regards,
    Rob Craig
    Rapid Deployment Software
    http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

5. Re: Shared memory

YES you can have your controls in *.dlls but after convert a file to *.dll
it doesnt use the same namespace as win32lib.ew. Hence a control in *.dll no
longer points to Window1 etc...

I'm not sure on how to make it work but here it CAN be done.

----- Original Message ----- 
From: "Philip D." <philip1987 at hotmail.com>
To: <EUforum at topica.com>
Subject: Shared memory


>
>
> Is there any way to share memory between 2 different euphoria programs?
> This would need to include variables and routines to serve my purposes.
>
> 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.
>
> Thanks,
> Phil
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>
> -- 
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.548 / Virus Database: 341 - Release Date: 5/12/03
>


---



--

new topic     » goto parent     » topic index » view message » categorize

6. Re: Shared memory

----- Original Message ----- 
From: "Matt Lewis" <matthewwalkerlewis at yahoo.com>
To: <EUforum at topica.com>
Subject: RE: Shared memory


> 
> 
> 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.

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?

> You'd also want to know ahead of time which 
> control id's you'd want to share.  Then set up id's as constant values:
> 
> constant
> MAIN_WIN = 1,
> EDIT_TEXT = 2,
> THE_COMBO = 3, -- etc...
> 
> CREATE = 1,
> SET_FOCUS = 2,
> SET_TEXT = 3 -- etc...
> 
> In your app, then set up a sequence to hold the values and routine ids:
> 
> sequence my_controls, win_routines
> my_controls = { main_win, edit_text, the_combo }
> win_routines = { routine_id("create"), routine_id("setFocus"),
>  routine_id("setText")}
> 
> ...and a couple of callbacks:
> 
> function get_control_id( atom id )
> return my_controls[id]
> end function
> constant 
> GET_OBJECT = define_c_func( my_dll, "get_object",{},E_OBJECT),
> SET_OBJECT = define_c_proc( my_dll, "set_object", {E_OBJECT})
> function call_win_func( atom routine )
> sequence args
> object return_val
> args = c_func( GET_OBJECT, {})
> return_val = call_func( win_routines[routine], args )
> if atom(return_val) then
> return return_val
> end if
> c_proc( SET_OBJECT, { return_val })
> return -1
> end function
> 
> Unfortunately, only in calls *to* the dll will you be able to pass 
> sequences, which is why you'll have to have functions in the DLL called 
> get_object() and set_object() that can return and set the value of a 
> local variable.  It's  somewhat complicated, but I don't see why it 
> couldn't work.  I may try to code this up as a standalone library...

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.

-- 
Derek

new topic     » goto parent     » topic index » view message » categorize

7. Re: Shared memory

----- Original Message ----- 
From: "Matt Lewis" <matthewwalkerlewis at yahoo.com>
To: <EUforum at topica.com>
Subject: RE: Shared memory


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

I think you are right. This is what happens when one asks for help about a
specific solution rather than help about what one is trying to achieve. I must
stop taking people so literally. I keep assuming that people mean what they say.
Dumb, I know, but its a habit I have that is very hard to break.

-- 
Derek

new topic     » goto parent     » topic index » view message » categorize

8. Re: Shared memory

----- Original Message ----- 
From: "Philip D." <philip1987 at hotmail.com>
To: <EUforum at topica.com>
Subject: RE: Shared memory


> 
> 
> Matt Lewis wrote:
> > 
> > 
> > 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?  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.  You'd also want to know ahead of time which 
> > control id's you'd want to share.  Then set up id's as constant values:
> > 
> > constant
> > MAIN_WIN = 1,
> > EDIT_TEXT = 2,
> > THE_COMBO = 3, -- etc...
> > 
> > CREATE = 1,
> > SET_FOCUS = 2,
> > SET_TEXT = 3 -- etc...
> > 
> > In your app, then set up a sequence to hold the values and routine ids:
> > 
> > sequence my_controls, win_routines
> > my_controls = { main_win, edit_text, the_combo }
> > win_routines = { routine_id("create"), routine_id("setFocus"),
> >  routine_id("setText")}
> > 
> > ...and a couple of callbacks:
> > 
> > function get_control_id( atom id )
> > return my_controls[id]
> > end function
> > constant 
> > GET_OBJECT = define_c_func( my_dll, "get_object",{},E_OBJECT),
> > SET_OBJECT = define_c_proc( my_dll, "set_object", {E_OBJECT})
> > function call_win_func( atom routine )
> > sequence args
> > object return_val
> > args = c_func( GET_OBJECT, {})
> > return_val = call_func( win_routines[routine], args )
> > if atom(return_val) then
> > return return_val
> > end if
> > c_proc( SET_OBJECT, { return_val })
> > return -1
> > end function
> > 
> > Unfortunately, only in calls *to* the dll will you be able to pass 
> > sequences, which is why you'll have to have functions in the DLL called 
> > get_object() and set_object() that can return and set the value of a 
> > local variable.  It's  somewhat complicated, but I don't see why it 
> > couldn't work.  I may try to code this up as a standalone library...
> > 
> > Matt Lewis
> > 
> 
> This is a little confusing; if you have time, could you give a demo of 
> how to make a main window with a button in it ( button created in DLL).  
> I was speaking for just a way to do this, not necessarily a way to do it 
> with two win32lib includes.
> 
> Thanks,
> Phil
> 
> 
> 
> TOPICA - Start your own email discussion group. FREE!
> 
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu