Michael Check wrote:

On 4/10/06, Brad Perkins <[EMAIL PROTECTED]> wrote:
What Randy says is what I meant. Additionally, we use ITK. I don't have
the code handy, but I recall reinitializing any process variables used
in A4D code at the start of each slave loop just to make sure they are
'clean'.

OK, thanks guys!  I think I understand now.

What do you mean by "slave loop"?  How does this allow the A4D process
variables that we're pointing at to be created by 4D itself?
When using ITK as a web server you have a master listener which hands incoming requests off to an available running slave process. Each slave process handles the request, goes to sleep, and makes itself available for reuse. Since you have no control over which process will handle any particular request, you are basically using a slave process' 4D Process variable value for one loop iteration. After that it is meaningless. Therefore any process variables that you are sharing between Active4D and 4D need to be reinitialized with each request. If you are using 4Ds built-in web server and relying on process variables you need to do this there too.

It doesn't have any relation to auto creating variables. For your situation you may need to estimate how many your going to need and predeclare them. Or you could write a variable pooling mechanism in 4D that is like the BASh DSS module and hope that works (see my comment below).

And since we're calling these ObjectTools methods as wrappers in many
places in the database, and don't really know what variables may need
to be pre-decalred, does it make sense that these wrapper methods
should then be written in A4D as a library instead?
I don't think you can do that (yet?). A4D can't call plug-ins directly.

I've had similar situations where I needed to pass arrays between Active4D and a 4D method. Following the traditional 4D "way of thinking" you have to use a pointer to do that.

As I mentioned before I was using the Bash DSS module to do this, but have had random instability problems when calling DSS methods from A4D code. If you are not familiar with DSS it gives you a pool of reusable variables and was designed so that the developer doesn't have to predeclare a bunch of process pointer variables just so you can pass a value between methods or between methods/plugins. In most cases my passed arrays are small with no more than a hundred items or so. My solution was to pack the array items into a string in my Active4D code and unpack them into an array in my 4D code. I use the same technique in reverse where I'd need a 4D method to return an array to Active4D (an example is a set of routines that does Set Math on arrays). I found it simpler to return the "array" as a string of delimited values that to deal with the hassle of dedicating a 4D process variable for the task.

Since Active4D has a excellent built-in text processing tools this is very easy to do.

-- Brad Perkins
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to