POV-Ray : Newsgroups : povray.programming : Invoking POV-Ray via GUI Extension Server Time
28 Jul 2024 22:16:19 EDT (-0400)
  Invoking POV-Ray via GUI Extension (Message 1 to 5 of 5)  
From: Ryan Hagelstrom
Subject: Invoking POV-Ray via GUI Extension
Date: 5 Mar 1999 02:14:49
Message: <36DF8346.9B5D482F@silver.sdsmt.edu>
I'm am currently working on a GUI Extension for our senior design
project. I'm having a problem with getting the GUI extension invoking
the POV-Ray Render routine.

The function runs fine if I call it within the DLL, like if I call it
from the required GUIExt About box. It GPF's when it is called from an
external program. This leads me to believe that InitStruct is not
pointing to the same memory because,  which it should because I have it
defined within the data_seg and specify it as shared.

Any help would be greatly appreciated. If you would like to see my full
source, let me know.

Thanks Ryan

My render function is as follows


//Globals
#pragma data_seg ("shared")

ExternalVarStruct POVVarsStruct = {NULL} ;
GuiExtInitStruct *InitStruct = NULL ; // Points to the Initstruct that
POV Loads

#pragma data_seg ()

EXPORT BOOL CALLBACK RenderStart(PSTR pSource, PSTR pCommand)
{

 //Initialize the POVVarsStruct
  POVVarsStruct.RecSize = sizeof(ExternalVarStruct);

 //Loads the current Pov Vars into POVVarsStruct
 InitStruct->ExternalRequest (RequestGetVars, &POVVarsStruct );

 //Change to the source file that we wish to render
 strcpy(POVVarsStruct.source_file_name,pSource);

  //If we have command line swiches, change them too
  if (pCommand != NULL)
 strcpy(POVVarsStruct.command_line, pCommand);

 // Set the POV vars to what we want
 InitStruct->ExternalRequest (RequestSetVars, &POVVarsStruct);

 // Start the POV rendering
 if(ExRequestOK != InitStruct->ExternalRequest
(RequestStartRendering,NULL))
 {
  InitStruct->ExternalRequest(RequestStartRendering,NULL);

  return FALSE;
 }
 else
  return TRUE;
}


Post a reply to this message

From: povray org admin team
Subject: Re: Invoking POV-Ray via GUI Extension
Date: 5 Mar 1999 06:56:00
Message: <36e0c642.21537984@news.povray.org>
>The function runs fine if I call it within the DLL, like if I call it
>from the required GUIExt About box. It GPF's when it is called from an
>external program. This leads me to believe that InitStruct is not
>pointing to the same memory because,  which it should because I have it

Without looking at your source, I'll make one point: if you are loading the DLL
from another process, and depending on sharing data between your process and
the instance of the DLL loaded by POV-Ray, then -don't-.

Win32 processes each have their own address space. Data you initialize in one
instance of the DLL is not going to be visible in the other one unless you do
stuff to make it so (like using global shared memory). This is because DLL's
are loaded into the address space of the host process.


Post a reply to this message

From: Ron Parker
Subject: Re: Invoking POV-Ray via GUI Extension
Date: 5 Mar 1999 09:12:01
Message: <36dfe631.0@news.povray.org>
On Fri, 05 Mar 1999 00:09:58 -0700, Ryan Hagelstrom 
	<rlh### [at] silversdsmtedu> wrote:

>#pragma data_seg ("shared")

This isn't enough.  You also need linker options, which you may or may
not have set.  The option you need is

/section:shared,RWS

If you're using VC6, just type this at the end of the editbox at the bottom 
of the link tab in the project settings dialog.  Remember to do it for both 
debug and release.

Just giving a segment the name "shared" doesn't automatically make it shared. :)

Also, make sure that your shared data does not reference anything outside the
shared segment.  That is, no pointers to unshared data.


Post a reply to this message

From: Ryan Hagelstrom
Subject: Re: Invoking POV-Ray via GUI Extension
Date: 6 Mar 1999 00:45:33
Message: <36E0BFD9.7605A4CE@silver.sdsmt.edu>
>
> >#pragma data_seg ("shared")
>
> This isn't enough.  You also need linker options, which you may or may
> not have set.  The option you need is
>
> /section:shared,RWS

I already had this specified in my makefile.

From what I understand about shared memory with DLL's, my code _should_ work, but it
doesn't. I was wondering if I just made some stupid mistake, or if there is some
other way to go about this.

Anything would be helpfull.

thanks

ryan


Post a reply to this message

From: Friedemann Schmidt
Subject: Re: Invoking POV-Ray via GUI Extension
Date: 7 Mar 1999 20:40:27
Message: <MPG.114d4849c34510d7989680@news.povray.org>
[Dieser Folgebeitrag wurde in povray.programming plaziert und eine Kopie 
wurde an den zitierten Autor gesandt.]

Hi Ryan,

in my GUI extension (Visual C++ 4.0) I declared the variables which have 
to be accessed from POV-Ray and the external program by

  // Global variables which could be read by POV-Ray (as client) 
  // and also the server program
  #pragma data_seg("TVPOVCOM_GLOBAL")
    HWND hPOVWindow_g = 0;
    HWND hAppWindow_g = 0;
    BOOL boEnabled_g = FALSE;
    char acRenderFile_g[_MAX_PATH] = "\0";
    ...
  #pragma data_seg()

In the DEF-file I included the following:

  SECTIONS 
    TVPOVCOM_GLOBAL READ WRITE SHARED

I didn't get a shared InitStruct working for myself. So, if I want to 
start a rendering by my program, I call a function StartRender(filename) 
which stores the filename in acRenderFile_g. Then it drags a (hopefully) 
none existing file "tvpovcom.StartRender" to POV-Ray. POV-Ray then calls 
the DragFunction in which you can start the render process of 
acRenderFile_g if DropType==dfRealDrop and the name of the dragged file 
is "tvpovcom.StartRender".

I know, this is a bit circumstantial, but it works fine.

Bye,
Friedemann
-- 
Friedemann Schmidt
F.S### [at] fhtw-berlinde
Raytracing-Gallery: http://www.rz.fhtw-berlin.de/~s0049669/indexe.html
TextureView: http://www.rz.fhtw-berlin.de/~s0049669/software.html


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.