comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » call_external segmentation fault
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
call_external segmentation fault [message #55306] Wed, 15 August 2007 17:36
sc.bugger is currently offline  sc.bugger
Messages: 2
Registered: August 2007
Junior Member
Are there some pitfalls in using 'call_external' of C libraries which
were created by different gcc versions?
I have exactly the same code working on the one computer (linux x86
m32, gcc 3.4.5) and crashing on the other one (linux x86, m32, gcc
4.2.1). What can be the problem?
I use "gcc -fPIC -c mypro.c && ld -shared -o libmypro.so mypro.o"
Here is the code, nothing especially:


-------------- mypro.c ----------------
#include <stdio.h>
#include <math.h>
#include "/opt/idl/external/include/idl_export.h"

int wsum(int argc, void *argv[])
{
float *coeff, *xmax, *out, *xvalue;
IDL_MEMINT *nc, *nx, i,j;

wights = (float *) argv[0];
nc = (IDL_MEMINT *) argv[1];
nx = (IDL_MEMINT *) argv[2];
xmax = (float *) argv[3];
out = (float *) argv[4];

for (i=0; i<*nx; i++)
{
*xvalue = -*xmax + 2. * *xmax * i/(*nx-1);
*(out + i) = 0.;
for (j=0; j<*nc; j++)
*(out + i) += pow(*xvalue,j+1) * *(wights + j);
}

return 1;
}

----------------- mytest.pro --------------------
function mytest, wights, nx, xmax, out

return, call_external('libmypro.so','wsum',$
wights, $
n_elements(coeffs), $
nx, $
xmax, $
out, /f_value)

end


Thank you for any hint.
Vlad
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: MODIS Conversion Toolkit problems in batch processing: please help me out!!
Next Topic: waiting for IDL7.0

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:42:15 PDT 2025

Total time taken to generate the page: 0.00603 seconds