[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [xmlblaster] Solaris C build changes



Correction! 
Your changed did work I just modified the wrong file in tmp ;) my bad.
Now off to AIX... 

-----Original Message-----
From: Joshi, Mehul 
Sent: Friday, September 22, 2006 3:39 PM
To: 'xmlblaster at server.xmlBlaster.org'
Subject: RE: [xmlblaster] Solaris C build changes

Yes it was the const that compiler complained about.

======================
$  CC -V
CC: Sun C++ 5.5 2003/03/12

New suggestions also did not work.
=======================
Dll_Export XmlBlasterAccessUnparsed
*getXmlBlasterAccessUnparsedUnmanaged(int argc, const char* const* argv){
   /** argv seems to be freed by C#, so we clone it here */
   int i=0;
   const char ** ptr = (const char **)malloc(argc*sizeof(char *));    
   for (i=0; i<argc; ++i) {
      ptr[i] = strcpyAlloc(argv[i]);
   }
   return getXmlBlasterAccessUnparsed(argc, ptr); }

And compiler generates the following problems ================
       [cc] CC -c -g -mt -KPIC -D__sunos__=1 -D__sparc__=1 -DUsePthread=1
-D_REENTRANT=1 -DPthreadDraftVersion=10 -DXMLBLASTER_C_COMPILE_AS_CPP=1
-I/xta/joshim/mom/xmlBlaster/build.tmp/src/c
/xta/joshim/mom/xmlBlaster/build.tmp/src/c/util/helper.c
/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/XmlBlasterAccessUnparsed.c
/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/CallbackServerUnparsed.c
/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/XmlBlasterConnectionUnpars
ed.c /xta/joshim/mom/xmlBlaster/build.tmp/src/c/util/msgUtil.c
/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/xmlBlasterSocket.c
/xta/joshim/mom/xmlBlaster/build.tmp/src/c/util/Properties.c
/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/xmlBlasterZlib.c
/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/XmlBlasterUnmanaged.c
       [cc]
"/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/XmlBlasterAccessUnparsed.
c", line 345: Warning (Anachronism): Formal argument 3 of type extern "C"
void*(*)(void*) in call to pthread_create(unsigned*, const _pthread_attr*,
extern "C" void*(*)(void*), void*) is being passed void*(*)(void*).
       [cc]
"/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/XmlBlasterAccessUnparsed.
c", line 958: Warning (Anachronism): Formal argument 3 of type extern "C"
void*(*)(void*) in call to pthread_create(unsigned*, const _pthread_attr*,
extern "C" void*(*)(void*), void*) is being passed void*(*)(void*).
       [cc] 2 Warning(s) detected.
       [cc]
"/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/CallbackServerUnparsed.c"
, line 391: Warning (Anachronism): Formal argument 3 of type extern "C"
void*(*)(void*) in call to pthread_create(unsigned*, const _pthread_attr*,
extern "C" void*(*)(void*), void*) is being passed void*(*)(void*).
       [cc]
"/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/CallbackServerUnparsed.c"
, line 395: Warning (Anachronism): Formal argument 3 of type extern "C"
void*(*)(void*) in call to pthread_create(unsigned*, const _pthread_attr*,
extern "C" void*(*)(void*), void*) is being passed void*(*)(void*).
       [cc] 2 Warning(s) detected.
       [cc]
"/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/XmlBlasterUnmanaged.c",
line 80: Error: Cannot assign void* to const char**.
       [cc]
"/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/XmlBlasterUnmanaged.c",
line 248: Error: Cannot use void* to initialize char*.
       [cc] 2 Error(s) detected.
       [cc] /xta/joshim/mom/xmlBlaster/build.tmp/src/c/util/helper.c:
================ 


I will stick to the new variable for now unless you have a cleaner option
that is portable.
I need to Port this code to AIX to make it usable in app. I will testhi out
there as well.
BTW any tips on how to go about starting a new port?
I am not familier with build scripts.


As usual Thanks :)
And Have a wonderful weekend!



-----Original Message-----
From: Marcel Ruff [mailto:mr at marcelruff.info] 
Sent: Friday, September 22, 2006 3:02 PM
To: xmlblaster at server.xmlBlaster.org
Subject: Re: [xmlblaster] Solaris C build changes

Joshi, Mehul wrote:
> FYI:
>
> Just some notes in case someone else runs into the same issues 
> compiling C libs on solaris.
> Please feel free to comment perhaps there are is a better way to do
this...
>
> OS:
> SunOS fuj01 5.8 Generic_117350-05 sun4us sparc FJSV,GPUZC-M $run 
> command $./build -verbose -Duse-CC=true  c ..this caused 2 errors in 
> XmlBlasterUnmanaged.c file. They both seem to be casting errors.
> I have fixed these as follows:
>
> ======================================================================
> ======
> ===================
>      75
>     76  Dll_Export XmlBlasterAccessUnparsed 
> *getXmlBlasterAccessUnparsedUnmanaged(int argc, const char* const* argv){
>     77     /** argv seems to be freed by C#, so we clone it here */
>     78     int j,i=0;                   		 /* Changed line */
>     79     char ** ptr; 
>     80     j = sizeof(char *);			 /*New line*/
>     81     ptr = (char **) malloc(argc * j);	 /* Changed line */
>   
Hmm, why do we need to introduce the temporary variable 'j'?
What was the compiler error reported? Does it complain about the 'const' 
which you have removed or does it complain about the malloc(argc*sizeof(char
*))?

On my Solaris it doesn't complain.

Does this work?
   int i=0;
   const char ** ptr = (const char **)malloc(argc*sizeof(char *));
   for (i=0; i<argc; ++i) {

>     82     for (i=0; i<argc; ++i) {
>     83        ptr[i] = strcpyAlloc(argv[i]);
>     84     }
>     85     return getXmlBlasterAccessUnparsed(argc, ptr);
>     86  }
> "/xta/joshim/mom/xmlBlaster/build.tmp/src/c/socket/XmlBlasterUnmanaged.c"
> [Modified] line 47 of 252 --18%--
> ======================================================================
> ======
> ===================
>
>
>    248  Dll_Export const char *xmlBlasterUnmanagedUsage() {
>    249     char *usage = (char
> *)malloc(XMLBLASTER_MAX_USAGE_LEN*sizeof(char));   /* changed line*/
>    250     return xmlBlasterAccessUnparsedUsage(usage);
>    251  }
>   
This cast was already fixed directly after the release of 1.3 (see current
svn),

thanks for reporting

Marcel
>    252
>
> ======================================================================
> ======
> ===================
>
>
>
>