|
From: <che...@bi...> - 2004-01-07 13:13:56
|
Hi heri,
My name is Chet and I am working with Bob on RLIB development.
I am patching in the changes that you submitted, but Linux defines iconv,
arg2 as (char **). Casting to (const char **) generates type-mismatches
when we compile on Linux.
Do you, (or anyone), know of a way to determine when to use one vs. the
other? If we can find out how to tell the difference, we'll make it
conditional.
I'll be checking the rlib_dump_profile change later.
Chet
> From: H. Steuer <st...@un...>
> To: Bob Doan <bd...@si...>
> Subject: Re: [Rlib-users] rlib on OpenBSD
> Date: Sat, 03 Jan 2004 03:06:56 +0100
>
> Hi Bob,
>
> thanks for your quick answer.
>
> The iconv thing was just a tiny issue, as the prototype expects a const
> char** as its second argument.
>
> i attached 2 diffs for your project which may be interresting to you.
> the api.c diff should be important for portability.
> e.g. solaris and msvc++ do #define stdout (&_iob[1]), so you can
> do something like stdout=...
> but BSD derivatives define stdout another way:
> extern FILE *__stdinp, *__stdoutp, *__stderrp;
> #define stdout (__stdoutp)
>
> which makes stdout an improper l-value for such an assignement.
> the way i've rewritten it should work well on all platforms.
>
> i just finished the patches and checked the lib compiles so far, will
> check if it produces any acceptable results tomorrow (its 3:02am now,
> time for some ZzZ).
>
> anyways i wanted to send the patches for review.
>
>
> regards,
> heri
>
>
>
>
>
>
>
>
> On Fri, 02 Jan 2004 14:48:54 -0500
> Bob Doan <bd...@si...> wrote:
>
>> I think we had someone get it working on freebsd
>>
>> RLIB cvs is much more cross platform friendly (uses gmodule stuff.. so
>> no implicit -dl)
>>
>> What problems are you having w/ iconv?? can you send a patch or
>> somthing?
>>
>> - Bob
>>
>> On Fri, 2004-01-02 at 13:47, H. Steuer wrote:
>> > Hi guys,
>> >
>> > im trying to compile rlib on OpenBSD.
>> > After removing -ldl, fixing a few lines of code due to incompatible
>> pointer types (e.g. to iconv()) i was stuck when it came to some
>> libtool errors. i'm not into libtool stuff and therefore was not
>> able to debug it further. did one of you guys ever compile rlib on a
>> *BSD machine?
>> >
>> > kind regards,
>> > heri
>> >
>>
>
>
> --=-zUKmL0hsn+72MVYtxFM1
> Content-Type: application/octet-stream; name="api.c.diff"
> Content-Disposition: attachment; filename="api.c.diff"
> Content-Transfer-Encoding: 7bit
>
> --- api.c.orig Fri Jan 2 23:32:49 2004
> +++ api.c Sat Jan 3 02:53:58 2004
> @@ -20,6 +20,7 @@
>
> #include <stdio.h>
> #include <stdlib.h>
> +#include <unistd.h>
> #include <string.h>
> #include <locale.h>
>
> @@ -224,29 +225,41 @@
> }
>
>
> -void rlib_dump_profile_fp(gint profilenum, FILE *fp) {
> - FILE *temp;
> +void rlib_dump_profile_fp(gint profilenum) {
> fflush(stdout);
> - temp = stdout;
> - if (fp) stdout = fp;
> printf("\nRLIB memory profile #%d:\n", profilenum);
> g_mem_profile();
> fflush(stdout);
> - stdout = temp;
> }
>
>
> void rlib_dump_profile(gint profilenum, const gchar *filename) {
> FILE *newout = NULL;
> + int fd = 0;
>
> if (filename) {
> newout = fopen(filename, "a");
> }
> + else {
> + /*
> + * need to re-assign stdout a proper way !
> + *
> + * stdout is not always &_iob[1], so you cant
> + * count that its a propper l-value.
> + */
> +
> + fd=dup(STDOUT_FILENO);
> + freopen(filename,"wb",stdout);
> + }
> +
> + rlib_dump_profile_fp(profilenum);
> +
> if (newout) {
> - rlib_dump_profile_fp(profilenum, newout);
> fclose(newout);
> } else {
> - rlib_dump_profile_fp(profilenum, stdout);
> + fflush(stdout); /* again */
> + close(STDOUT_FILENO);
> + dup2(fd,STDOUT_FILENO);
> rlogit("Could not open memory profile file: %s\n", filename);
> }
> }
>
> --=-zUKmL0hsn+72MVYtxFM1
> Content-Type: application/octet-stream; name="parsexml.c.diff"
> Content-Disposition: attachment; filename="parsexml.c.diff"
> Content-Transfer-Encoding: 7bit
>
> --- parsexml.c.orig Fri Jan 2 23:19:54 2004
> +++ parsexml.c Fri Jan 2 19:43:27 2004
> @@ -36,7 +36,7 @@
> if(rep->cd != NULL) {
> slen = strlen(str);
> bzero(dest, MAXSTRLEN);
> - iconv(rep->cd, &str, &slen, &olddest, &len);
> + iconv(rep->cd, (const char **)&str, &slen, &olddest, &len);
> } else {
> strcpy(dest, str);
> }
>
> --=-zUKmL0hsn+72MVYtxFM1--
>
>
>
>
> --__--__--
>
> _______________________________________________
> Rlib-devel mailing list
> Rli...@li...
> https://lists.sourceforge.net/lists/listinfo/rlib-devel
>
>
> End of Rlib-devel Digest
|