-
For the cookie ldg_open() function, it calls the ldg_load() function (modified with my patch), but it's the TSR environment variables that are used to open the library. We should find a way to transmit the caller environment to the TSR (use a new cookie ldg_open_env() function, with a char **environ as extra parameter?). In this case ldg_load must also be modified (or a ldg_load_env added), to...
2008-08-13 08:52:32 UTC by pmandin
-
Note that the patch does not work when the TSR is loaded, as in this case, the ldg_load() function is not called,
instead the cookie ldg_open() is called.
2008-08-13 07:09:31 UTC by pmandin
-
New patch, attached.
It requires -D_GNU_SOURCE=1, so we can access char **environ variable from the mintlib.
Then we can create a new environment string to pass to Pexec.
Now SDL.ldg correctly receives environment variables set for the caller process (the SDL application),
and it behaves like it was statically linked.
File Added: ldg.diff.
2008-08-12 22:58:27 UTC by pmandin
-
The proposed patch is not enough. Passing NULL as envstr parameter for Pexec, will make Pexec use environment set in basepage->p_env of the caller, instead of the environment stored in mintlib data space (char **environ), which is modified by putenv().
So, we must create a new environment string based on char **environ, and pass it to Pexec, to have it working.
2008-08-12 21:50:39 UTC by pmandin
-
Proposed patch:
--- ldg/src/devel/ldgload.c 25 Jul 2005 19:37:07 -0000 1.1
+++ ldg/src/devel/ldgload.c 12 Aug 2008 14:15:45 -0000
@@ -73,13 +73,20 @@
/* on met directement addr */
#ifdef __GNUC__
sprintf(offsetxt,"OFFSETLDG=%ld%c%c",(long)addr,'\0','\0');
+ putenv(offsetxt);
#else
strcpy(offsetxt,"OFFSETLDG=");
ltoa( (long)addr...
2008-08-12 14:16:36 UTC by pmandin
-
Instead of:
#ifdef __GNUC__
sprintf(offsetxt,"OFFSETLDG=%ld%c%c",(long)addr,'\0','\0');
#else
strcpy(offsetxt,"OFFSETLDG=");
ltoa( (long)addr, offsetxt+10, 10);
offsetxt[strlen( offsetxt) + 1] = '\0';
#endif
Using
#ifdef __GNUC__
sprintf(offsetxt,"OFFSETLDG=%ld%c%c",(long)addr,'\0','\0');
putenv(offsetxt);
#else
...
and using NULL instead of offsetxt to Pexec(3......
2008-08-12 12:42:19 UTC by pmandin
-
The ldg_load() function should use putenv() to add OFFSETLDG to current environment variables, and pass NULL to Pexec(3...). It should work, shouldn't it?.
2008-08-12 12:20:58 UTC by pmandin
-
Hello,
I compiled SDL as a LDG. Now I have a problem because SDL uses many environment variables, and they are not transmitted to the SDL.ldg.
I think the problem is in ldg/src/devel/ldgload.c line 82, when Pexec(3,...) is used to load LDG library.
It overwrites the current environment with "OFFSETLDG=" as the only environment variable, whereas it should add it to the current...
2008-08-12 10:09:02 UTC by pmandin
-
landemarre committed revision 73 to the Dynamic GEM Library (LDG) SVN repository, changing 1 files.
2008-01-12 17:17:07 UTC by landemarre
-
landemarre committed revision 72 to the Dynamic GEM Library (LDG) SVN repository, changing 4 files.
2008-01-12 15:46:08 UTC by landemarre