I need to interface libnetcdf with PHP. (the php-netcdf on google code is broken)
Here’s netcdf.i :
%module netcdf
%{
/* Includes the header in the wrapper code */
#include "netcdf.h"
%}
/* Parse the header file to generate wrappers */
%include "netcdf.h"
I did :
gcc `php-config --includes` -fpic -c netcdf_wrap.c
gcc -shared netcdf_wrap.o -o netcdf.so
but when loading the extension in php, I get :
Unable to load dynamic library netcdf.so:
undefined symbol: ncerr in Unknown on line 0
It’s the first time I try something like that. Am I missing something ?
ADDED -lnetcdf flag.
now, I got : undefined symbol: zend_error_noreturn. fixed replacing zend_error_noreturn by zend_error in netcdf_wrap.c
Your immediate problem is caused by not linking against libnetcdf. You need the
-lflag for gcc to do so: