Hi Arjen:

On 2013-03-04 13:20+0100 Arjen Markus wrote:
> On Thu, 28 Feb 2013 21:46:45 -0800 (PST)
> "Alan W. Irwin" <ir...@beluga.phys.uvic.ca> wrote:
>> Hi Arjen:
>> 
>> I am directing this mostly to you because of your Windows expertise.
>> 
>> I have been trying to build the wxwidgets device using MinGW/MSYS on the
>> Wine version of Windows.  All goes well (which I will discuss in
>> a further post) except for one issue:
>> 
>> bash.exe-3.1$ ../dll/test-drv-info.exe wxwidgets
>> 
>> delivers the expected string
>> 
>> wxwidgets:wxWidgets Driver:1:wxwidgets:51:wxwidgets
>> 
>> but if you execute
>> 
>> bash.exe-3.1$ echo $?
>> 
>> right after the above command you find there is a return code of 3.
>> That non-zero return code generates a make error which can be worked
>> around by simply running make again (which is how I got the wxwidgets
>> windows results which I will post in the next message).
>> 
>> Running test-drv-info.exe for ps, svg, or wingcc also generates
>> the expected strings in each case, but for these cases
>> test-drv-info.exe generates the correct return code of 0.
>> 
>> I prefer we solve the test-drv-info.exe issue for wxwidgets for
>> MinGW/MSYS rather than forcing our users to work around it by building
>> twice so I looked at the test-drv-info.c code, and it generates the
>> above string by
>>
>>     info = (char **) lt_dlsym( dlhand, sym );
>>     if ( info != NULL )
>>     {
>>        printf( "%s", *info );
>>        return 0;
>>     }
>> 
>> So the question is how can test-drv-info.exe generate a non-zero
>> return code when it obviously executes the above printf statement and
>> therefore must obviously execute the above return 0; which is
>> equivalent to exit(0); in this main routine case?
>> 
>> Wherever that return code is coming from, it appears not to be from
>> the code in test-drv-info.c since the exit and return commands all
>> return 0 or 1 which is obviously different from the return code of 3
>> that I observe for wxwidgets.  I therefore suspect the issue is
>> something done incorrectly by src/ltdl_win32.c in the lt_dlexit
>> routine for the case where dynamic loading loads additional libraries.
>> For example, our wxwidgets device depends on and therefore loads
>> wxWidgets libraries while our ps and svg devices have no external
>> library dependencies.  (I am not quite sure of the status of the
>> wingcc device external library dependencies.)
>
> I have never seen this effect before. It may be some
> kind of leftover return code from cleaning up when the
> program exits (program code that belongs to the runtime
> library, not the user's code).
>
> While that is not very helpful, can you try with exit(0)
> instead of "return 0"?

I tried that. However, according to "The C Programming
Language" by Kernighan and Ritchie "return nnnn" and "exit(nnnn)" are
equivalent for main routines so as expected this made no difference
for wxwidgets where a return code of 3 is still produced for
MinGW/MSYS.  I committed the change anyway (revision 12294)
because I think using exit rather than return is clearer for the main routine 
case.

I have now noticed some incomplete error reporting issues with
src/ltdl_win32.c so I am going to try some experiments with that.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to