Getting the jBase DP (data pointer) of the current session when using pure C

129 views
Skip to first unread message

Igor Osmolovskiy

unread,
Mar 3, 2020, 2:19:41 PM3/3/20
to jBASE
Dear all

I need the jBase DP (data pointer) to be initialized. I've actually managed to initialize it by calling the jbase_getdp(). But in both cases the new child session is created in jshell (and gets removed automatically after the code has been executed).

So I am wondering: is there a possibility to retrieve and use the current session DP somehow? So that no child session would get created

Any advice would be highly appreciated

Thanks in advance


PS: to the admin, it is actually a jBase related question rather than TAFC. Thanks


Kind regards,
Igor

Peter Falson

unread,
Mar 3, 2020, 3:06:27 PM3/3/20
to jb...@googlegroups.com
Can you post some code?

Sent from my iPhone

On Mar 3, 2020, at 11:19 AM, Igor Osmolovskiy <igo...@gmail.com> wrote:


--
--
IMPORTANT: T24/Globus posts are no longer accepted on this forum.
 
To post, send email to jB...@googlegroups.com
To unsubscribe, send email to jBASE-un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en

---
You received this message because you are subscribed to the Google Groups "jBASE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/73153581-25ae-493a-95f6-8afc5cdf7813%40googlegroups.com.

Jim Idle

unread,
Mar 4, 2020, 2:11:30 AM3/4/20
to jBASE
Wow - it has been a long time since that code ;) However, what you ask is possible I believe. It depends on your context. Are writing a pure C program and wish to call in to subroutines etc? 

Probably the best place to start is to generate the C code for a very small jBC program:

lufc.b
CRT "Leeds United are Magic!"

jbc -S lufc.b

Then you will see the startup sequence for a standard executable and can copy the code. 

However, my memory is vague, but I think that we had a C function you can call to do what you are doing and that will return the dp for reuse. It get's passed to subroutines for instance. 

Perhaps you can post the code you currently have.

Jim

--

Igor Osmolovskiy

unread,
Mar 4, 2020, 10:05:37 AM3/4/20
to jBASE
Hello Jim,

Thanks for your participation in the discussion :)

Are writing a pure C program and wish to call in to subroutines etc? 
Yes, that's the idea. Actually the final goal is wider, namely to write a Python extension in C that would call JBC functions. Basically I managed to do it but this excessive session is something would be good to get rid of.

I've applied jbc -S myrtn.b for a simple code already which results in producing 2 files: myrtn.c and the myrtn.j, the latter one being included into the .c one via #include "myrtn.j". 
But in the .j file already we can see the lines like
    #define DEF_SEL_VAR JLibReturnDefaultSelect(dp) /* Default select list for this program */
    #define DEF_FILE_VAR JLibReturnDefaultFile(dp) /* Default file descriptor for this program */

i.e. dp is supposed to be initialized already by the moment myrtn is called.

I've managed to find the next dp related functions mentioned in some libraries
jbase_getdp() - this works, i.e. initializes dp, but creates a new session
jbase_getdp_nocreate() - not working if called alone. but it works and returns the dp1 value when called after jbase_getdp(), and dp1 = dp in this case
jbase_getdpEX() - not sure what it should do
jbase_setdpEX() - not sure what it should do       


Please see the sample piece of code

#include <jsystem.h>
extern "C" DPSTRUCT *jbase_getdp();

...

PyMODINIT_FUNC
jbc_oconv(PyObject*, PyObject* _args)
{
...
DPSTRUCT
*dp = jbase_getdp();
OCONV_BBBBB
(result, tmp, VarHelper(arg1), VarHelper(arg2));  // this if defined in jsystem.h as   #define OCONV_BBBBB(Target, ConvReg, Source, Conversion) JLibGConvRun(dp, ConvReg, Target, Source, Conversion, 1)
...
}



I've tried to read the jmainfunction.obj  as well where some other jbase related functions are mentioned but could not figure out any useful one...

Maybe there is something I am missing or some non-documented function?

Would appreciate any hints! :)
Thanks
Igor

среда, 4 марта 2020 г., 8:11:30 UTC+1 пользователь Jim Idle написал:
To unsubscribe from this group and stop receiving emails from it, send an email to jb...@googlegroups.com.

Igor Osmolovskiy

unread,
Mar 4, 2020, 10:05:45 AM3/4/20
to jBASE
Hello
pls see my response to Jim with the code sample

вторник, 3 марта 2020 г., 21:06:27 UTC+1 пользователь pfalson написал:
Can you post some code?

Sent from my iPhone

On Mar 3, 2020, at 11:19 AM, Igor Osmolovskiy <igo...@gmail.com> wrote:


Dear all

I need the jBase DP (data pointer) to be initialized. I've actually managed to initialize it by calling the jbase_getdp(). But in both cases the new child session is created in jshell (and gets removed automatically after the code has been executed).

So I am wondering: is there a possibility to retrieve and use the current session DP somehow? So that no child session would get created

Any advice would be highly appreciated

Thanks in advance


PS: to the admin, it is actually a jBase related question rather than TAFC. Thanks


Kind regards,
Igor

--
--
IMPORTANT: T24/Globus posts are no longer accepted on this forum.
 
To post, send email to jB...@googlegroups.com
To unsubscribe, send email to jBASE-un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en

---
You received this message because you are subscribed to the Google Groups "jBASE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jb...@googlegroups.com.

Igor Osmolovskiy

unread,
Mar 4, 2020, 10:05:53 AM3/4/20
to jBASE
I've simplified the code a bit in my previous reply to give an idea.
Actually dp is defined as a static variable in a separate class and its value is returned by a dedicated class function.


среда, 4 марта 2020 г., 8:11:30 UTC+1 пользователь Jim Idle написал:
Wow - it has been a long time since that code ;) However, what you ask is possible I believe. It depends on your context. Are writing a pure C program and wish to call in to subroutines etc? 
To unsubscribe from this group and stop receiving emails from it, send an email to jb...@googlegroups.com.

Peter Falson

unread,
Mar 4, 2020, 10:11:12 AM3/4/20
to jb...@googlegroups.com
We have some examples of python calling a subroutine and vice versa. I will dig around. 

Sent from my iPhone

On Mar 4, 2020, at 7:05 AM, Igor Osmolovskiy <igo...@gmail.com> wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/5c46377f-4c68-4f50-a5fb-9d1d8164232b%40googlegroups.com.

Igor Osmolovskiy

unread,
Mar 4, 2020, 1:55:19 PM3/4/20
to jBASE
Thanks Peter, would be really helpful!

I've tried two ways
1. ctypes library. I managed to call a JBC function but it requires quite a lot work as the explicit variable types are required in this case. So all the transformations from PythonObj to a C type is required for each argument. Also in many cases polymorphismе would be required as JBC arguments often assume different types.
2. building a python library via distutils and working with PythonObj only. As I've mentioned already this works but was not able to get rid of the additional session being created at the step of "import lib" in python code.

среда, 4 марта 2020 г., 16:11:12 UTC+1 пользователь pfalson написал:

Peter Falson

unread,
Mar 4, 2020, 3:08:25 PM3/4/20
to jb...@googlegroups.com
What version of jBASE do you have?

Sent from my iPhone

On Mar 4, 2020, at 10:55 AM, Igor Osmolovskiy <igo...@gmail.com> wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/8ed5e66b-8076-495b-8b66-c7db7d4e8629%40googlegroups.com.

Quay Tar

unread,
Mar 4, 2020, 3:42:53 PM3/4/20
to jb...@googlegroups.com
Haven't found my "working" example yet (might've been on a docker I blew away). I did find some WIP code but some of the includes it uses are not distributed.

Maybe this will help you get further until I find something concrete:

#include "Python.h"
#include <jsystem.h>

int ParseArguments(char* arr[],Py_ssize_t size, PyObject *args) {
        /* Get arbitrary number of strings from Py_Tuple */
        Py_ssize_t i;
        PyObject *temp_p, * pyStr;

                temp_p = PyTuple_GetItem(args,i);
                if(temp_p == NULL) {return 0;}
                char *ptr = PyUnicode_AsUTF8AndSize(temp_p, &size);
                arr[i] = strdup(ptr);
        }
        return 1;
}

static PyObject * jbasepy_callsub(PyObject *self, PyObject *args)
{
        struct jBASEDataAreas *dp;

        dp = jbase_getdpEX(NULL,NULL,1,NULL);
        if (dp != NULL)
        {
                char * subroutineName;
                Py_ssize_t TupleSize = PyTuple_Size(args);
                char ** all_args = malloc(TupleSize * sizeof(char*));
                PyObject * list_out;
                if (ParseArguments(all_args, TupleSize, args))
                {
                        subroutineName = all_args[0];
                        int (*subptr)() = JediObjectFindFunction(dp, subroutineName, 2);
                        if (subptr != NULL)
                        {
                                int i;
                                char V[256];
                                memset (V, 'V', TupleSize-1);
                                V[TupleSize-1] = '\0';  /* null terminate. */
                                VAR *varArg, **varArgs = malloc((TupleSize-1) * sizeof(VAR*));
                                for(i = 1; i < TupleSize; ++i)
                                {
                                        varArgs[i-1] = malloc(sizeof(VAR));
                                        varArg = varArgs[i-1];
                                        VAR_INITIALISE_VB(varArg);
                                        STORE_VBS(varArg,(STRING*)all_args[i]);
                                }
                                list_out = PyUnicode_FromString((char*)CONV_SFB(varArgs[0]));
                                for(i = 1; i < TupleSize; ++i)
                                {
                                        VAR * varArg = varArgs[i-1];
                                        VAR_RELEASE_VB(varArg);
                                        free(varArgs[i-1]);
                                        free(all_args[i]);
                                }
                                free(all_args[0]);
                                char V[256];
                                memset (V, 'V', TupleSize-1);
                                V[TupleSize-1] = '\0';  /* null terminate. */
                                VAR *varArg, **varArgs = malloc((TupleSize-1) * sizeof(VAR*));
                                for(i = 1; i < TupleSize; ++i)
                                {
                                        varArgs[i-1] = malloc(sizeof(VAR));
                                        varArg = varArgs[i-1];
                                        VAR_INITIALISE_VB(varArg);
                                        STORE_VBS(varArg,(STRING*)all_args[i]);
                                }
                                subptr(dp, V, varArgs[0], varArgs[1], varArgs[2], varArgs[3], varArgs[4], varArg
s[5], varArgs[6], varArgs[7], varArgs[8], varArgs[9]);
                                list_out = PyUnicode_FromString((char*)CONV_SFB(varArgs[0]));
                                for(i = 1; i < TupleSize; ++i)
                                {
                                        VAR * varArg = varArgs[i-1];
                                        VAR_RELEASE_VB(varArg);
                                        free(varArgs[i-1]);
                                        free(all_args[i]);
                                }
                                free(all_args[0]);
                                free(all_args);
                                free(varArgs);
                                return list_out;
                        }
                        else
                        {
                                return PyUnicode_FromString("Subroutine not found");
                        }
                }
                return PyUnicode_FromString("Error parsing arguments");
        }
        return PyUnicode_FromString("Failed to initialise jBASE");
}

static PyMethodDef jbasepy_methods[] = {
        {"callsub", (PyCFunction)jbasepy_callsub, METH_VARARGS,
                PyDoc_STR("call jBASE subroutine")},

Marco Manyevere

unread,
Mar 4, 2020, 4:53:33 PM3/4/20
to jb...@googlegroups.com
Hi,

On some earlier release of jBase 5, I once had a need to "divert" a jBC subroutine call to go via my own jBC subroutine with the same name that then called the original (for which I didn't have source). I remember creating a C function to achieve that. The C function was declared like below. What I learned about the DP is that every subroutine is passed the DP as the first argument so you do not need to initialise it again - just pass it on.

I achieved my objective by compiling and cataloging a duplicate routine and making sure that my duplicate routine was in a search path that was found first before the existing routine. I would then call dllsym function below passing it the actual shared library file name that contained the original routine name (dll_name) and the name of the original subroutine (rtn_name) and the arguments in VAR*, .... (Note that I had typedef int (*fptrXX) for upto 20 arguments which was more than enough for all the subroutines I wanted to debug).

dlopen/dlsym system calls were key functions in this piece of code. In my case, the original jbase session was already started and from there, calls could be exchanged between jBC and C any number of times by just passing the DP along.

Hope it helps, Marco.

#include <stdlib.h>
#include <dlfcn.h>
#include <jsystem.h>

typedef int (*fptr)(struct jBASEDataAreas *dp, char *);
typedef int (*fptr1)(struct jBASEDataAreas *dp, char *, VAR *);
typedef int (*fptr2)(struct jBASEDataAreas *dp, char *, VAR *, VAR *);
typedef int (*fptr3)(struct jBASEDataAreas *dp, char *, VAR *, VAR *, VAR *);
typedef int (*fptr4)(struct jBASEDataAreas *dp, char *, VAR *, VAR *, VAR *, VAR *);

INT32 dllsym(struct jBASEDataAreas *dp, char *dll_name, char *rtn_name, char *vflags, VAR **arg)
{
   void *handle;
   fptr fun_ptr;

   int numargs = strlen(vflags);

   handle = dlopen(dll_name, RTLD_LOCAL | RTLD_LAZY);
   if (!handle) {
      printf("dlopen('%s') failed!: %s\n ",dll_name, dlerror());
      return 1;
   }

   *(void **)(&fun_ptr) = dlsym(handle, rtn_name);
   if (fun_ptr == NULL) {
      printf("dlsym('%s', '%s') failed!: %s\n", dll_name, rtn_name, dlerror());
      dlclose(handle);
      return 1;
   }
   switch(numargs) {
   case 0:
      (*fun_ptr)(dp, vflags);
      break;
   case 1:
      (*(fptr1)fun_ptr)(dp, vflags, arg[0]);
      break;
   case 2:
      (*(fptr2)fun_ptr)(dp, vflags, arg[0], arg[1]);
      break;
   case 3:
      (*(fptr3)fun_ptr)(dp, vflags, arg[0], arg[1], arg[2]);
      break;
   case 4:
      (*(fptr4)fun_ptr)(dp, vflags, arg[0], arg[1], arg[2], arg[3]);
      break;
   }
   dlclose(handle);
   return 0;
}


To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/c010b5b5-199a-42b8-a7fa-2b351052c29f%40googlegroups.com.

Jim Idle

unread,
Mar 5, 2020, 1:25:40 AM3/5/20
to jb...@googlegroups.com

I think then that the thing to do is ask Greg Cooper. @Bruce Decker - maybe you can facilitate this?

As I use OSX, I don’t have jBASE available without some messing around  Hunt Hint. OSX port would be easy. As would a docket image of jBASE :)

Jim

To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/c010b5b5-199a-42b8-a7fa-2b351052c29f%40googlegroups.com.

Patrick Payne

unread,
Mar 5, 2020, 7:51:09 PM3/5/20
to jBASE
Igor I see that you are trying to call into jBASE functions directly from Python, correct?  Based on what you are trying to do and required performance jBASE does now offer a Rest Interface which allows you to expose jBASE business rules to any language.  If are you trying to build a full wrapper for Python to allow you to code directly in Python vs Pick Basic then you will need Peter.  Keep in mind jBASE now offers direct inline C inside Pick Code which allows the opposite where you can directly call Python functions from jBASE by using the Python/C integration examples.  

Jim, from docker do

docker pull zumasys/jbase_base
docker run -it zumasys/jbase_base jb

Enjoy =)

Igor Osmolovskiy

unread,
Mar 6, 2020, 5:56:08 PM3/6/20
to jBASE
Peter, thanks for the code sample

Could you please elaborate on what exactly the next line means
jbase_getdpEX(NULL,NULL,1,NULL)

Thanks
Igor

Igor Osmolovskiy

unread,
Mar 6, 2020, 5:56:14 PM3/6/20
to jBASE
Marco, thank you for your shared experience

Regarding dp initialization the next was observed: if your starting point is JBC code that will in turn call the C extension, then dp is really initialized automatically. Whereas if you launch C/Python directly then dp is NULL and smth has to be done manually

Igor Osmolovskiy

unread,
Mar 6, 2020, 5:56:26 PM3/6/20
to jBASE
Peter, we are using jBase 5.1

I've now tried  to use
 static DPSTRUCT *dp = jbase_getdp_nocreate(NULL,NULL,1,NULL);
but it still creates a new session...

Would that be possible maybe to give an example of how jbase_getdp_nocreate() could be used please?
Its name sounds like intending not to create a new dp :)
thanks

среда, 4 марта 2020 г., 21:08:25 UTC+1 пользователь pfalson написал:

Peter Falson

unread,
Mar 6, 2020, 7:13:48 PM3/6/20
to jb...@googlegroups.com
That creates a regular jBASE session dp. The null args are more for internal use.

Sent from my iPhone

> On Mar 6, 2020, at 2:56 PM, Igor Osmolovskiy <igo...@gmail.com> wrote:
>
> Peter, thanks for the code sample
> --
> --
> IMPORTANT: T24/Globus posts are no longer accepted on this forum.
>
> To post, send email to jB...@googlegroups.com
> To unsubscribe, send email to jBASE-un...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/jBASE?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups "jBASE" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/050fac31-e1aa-46e0-99bd-59d6f8dcdea7%40googlegroups.com.

Peter Falson

unread,
Mar 6, 2020, 7:15:44 PM3/6/20
to jb...@googlegroups.com
Whichever method you use to get a dp, it is up to you to store it in a persistent object. 

Sent from my iPhone

On Mar 6, 2020, at 2:56 PM, Igor Osmolovskiy <igo...@gmail.com> wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/ca7da87a-4496-4920-af07-e04870eefe7b%40googlegroups.com.

Igor Osmolovskiy

unread,
Mar 9, 2020, 9:28:48 AM3/9/20
to jBASE
Thank you Peter

But do you think it is still possible to retrieve a DP for an existing session? 
It can be seen that no new session is created when a JBC program is being called in jshell e.g. Therefore a DP initialization is happening somehow for that case
Thanks

суббота, 7 марта 2020 г., 1:13:48 UTC+1 пользователь pfalson написал:
That creates a regular jBASE session dp. The null args are more for internal use.

Sent from my iPhone

> On Mar 6, 2020, at 2:56 PM, Igor Osmolovskiy <igo...@gmail.com> wrote:
>
> Peter, thanks for the code sample
>
> Could you please elaborate on what exactly the next line means
> jbase_getdpEX(NULL,NULL,1,NULL)
>
> Thanks
> Igor
>
> --
> --
> IMPORTANT: T24/Globus posts are no longer accepted on this forum.
>
> To post, send email to jB...@googlegroups.com
> To unsubscribe, send email to jBASE-un...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/jBASE?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups "jBASE" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jb...@googlegroups.com.

Peter Falson

unread,
Mar 9, 2020, 9:51:40 AM3/9/20
to jb...@googlegroups.com
If you want to use python in this mix then I would think you need to call python from jBASE so you can persist the dp. 

Sent from my iPhone

On Mar 9, 2020, at 6:28 AM, Igor Osmolovskiy <igo...@gmail.com> wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/3308135a-4d22-4124-88c0-d5b693d9ed2d%40googlegroups.com.

Dan Ell

unread,
Mar 9, 2020, 10:27:22 AM3/9/20
to jb...@googlegroups.com, Dan Ell

That would be because the jsh initiated the thread and the program running under it is a shared object /dll beneath that thread.

 

Dan Ell | jBASE Technical Engineer
jBASE International, Inc.
813-498-2544 | 866‑582‑8447
da...@jbase.com | www.jbase.com
1050 Calle Amanecer, Suite A | San Clemente, CA 92673
From: jb...@googlegroups.com <jb...@googlegroups.com> On Behalf Of Igor Osmolovskiy
Sent: Monday, March 9, 2020 6:10 AM
To: jBASE <jb...@googlegroups.com>
Subject: Re: Getting the jBase DP (data pointer) of the current session when using pure C

To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/3308135a-4d22-4124-88c0-d5b693d9ed2d%40googlegroups.com.

Igor Osmolovskiy

unread,
Mar 9, 2020, 1:36:26 PM3/9/20
to jBASE
This approach works, i.e. if we use a JBC program to call a Python that would call a C written extension module then DP is just passed and no additional session is being created.
But would be great not to use JBC as a starting point

понедельник, 9 марта 2020 г., 14:51:40 UTC+1 пользователь pfalson написал:

Igor Osmolovskiy

unread,
Mar 9, 2020, 1:36:32 PM3/9/20
to jBASE
Hello Dan
Right, but is there a possibility to avoid creating a new thread? 
One option proposed by Peter is to launch Pyhton from JBC e.g. But any chance to achieve this for pure Pyhton?

понедельник, 9 марта 2020 г., 15:27:22 UTC+1 пользователь DanE написал:

Peter Falson

unread,
Mar 9, 2020, 2:31:07 PM3/9/20
to jb...@googlegroups.com
Your only choices are start from jsh/jbc call python, call jbc etc or start with python call jbc. 

Either way the dp needs to be carried around. 

I can post an example of calling python (it needs jBASE 5).

Sent from my iPhone

On Mar 9, 2020, at 10:36 AM, Igor Osmolovskiy <igo...@gmail.com> wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/4d42aaec-5bed-4546-a748-4ccdc51a563e%40googlegroups.com.

Igor Osmolovskiy

unread,
Mar 10, 2020, 10:11:37 AM3/10/20
to jBASE
Would be interesting to have a look
Thanks!

понедельник, 9 марта 2020 г., 19:31:07 UTC+1 пользователь pfalson написал:

Quay Tar

unread,
Mar 10, 2020, 3:03:45 PM3/10/20
to jb...@googlegroups.com

To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/4d5408e1-e74e-4985-969e-c3b8d3cc3499%40googlegroups.com.

Igor Osmolovskiy

unread,
Mar 25, 2020, 10:14:37 AM3/25/20
to jBASE
Thanks Peter for your help

Coming back to the initial question whether a DP could be initialized without a new session - looks like it is not possible.
When we compile and catalog a JBC routine then a dll will be placed into bin. And when that JBC routine is called then it is actually called as a dll rather than executable (which can be removed even). So the same address space is used.
On the contrary when we call python then it is always a separate executable with its own address space..

вторник, 10 марта 2020 г., 19:03:45 UTC пользователь pfalson написал:

Peter Falson

unread,
Mar 25, 2020, 10:25:33 AM3/25/20
to jb...@googlegroups.com
Not following. If your starting point is jsh or LOGTO or a jBASE program you should be able to call a python routine and convert the dp to a pylong and pass it down for reuse.

Sent from my iPhone

On Mar 25, 2020, at 7:14 AM, Igor Osmolovskiy <igo...@gmail.com> wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/4cbd40b0-1cdd-4908-a7c0-3e0ab550adf1%40googlegroups.com.

Igor Osmolovskiy

unread,
Mar 25, 2020, 1:15:55 PM3/25/20
to jBASE
Right. If a jBASE routine is the starting point - no new session is created.

But if python is the starting point then looks like we cannot avoid an additional session

среда, 25 марта 2020 г., 14:25:33 UTC пользователь pfalson написал:

Peter Falson

unread,
Mar 25, 2020, 3:28:17 PM3/25/20
to jb...@googlegroups.com
Still not entirely sure why though. If python is the starting point and you get a dp from jbase_getdpEX (you cant avoid at least one session) you could pass the dp down the chain. 

Sent from my iPhone

On Mar 25, 2020, at 10:15 AM, Igor Osmolovskiy <igo...@gmail.com> wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/57591946-33e0-48c7-ab15-5f97473e238e%40googlegroups.com.

Igor Osmolovskiy

unread,
Mar 26, 2020, 9:09:52 AM3/26/20
to jBASE
Let's imagine we are in jshell, thus 1 session has been created already. Then
1. if we launch jBasic that calls .py there will be still 1 session (i.e. the same one)
2. if we launch python that calls .py the second session will be created

in both cases the same C extension with jbase_getdpEX inside is used

среда, 25 марта 2020 г., 19:28:17 UTC пользователь pfalson написал:

Peter Falson

unread,
Mar 26, 2020, 9:49:01 AM3/26/20
to jb...@googlegroups.com
Right. What I’m suggesting is that any python programs would need to pass on the dp pointer down the chain. 

Sent from my iPhone

On Mar 26, 2020, at 6:09 AM, Igor Osmolovskiy <igo...@gmail.com> wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/723e284a-e4f6-4674-ac9a-ada0c8f1a386%40googlegroups.com.

Igor Osmolovskiy

unread,
Mar 26, 2020, 11:39:16 AM3/26/20
to jBASE
Yep. This part works pretty well :)

четверг, 26 марта 2020 г., 13:49:01 UTC пользователь pfalson написал:
Reply all
Reply to author
Forward
0 new messages