I have cleared some of my confusion w.r.t. Lisp vs. Scheme vs. C "foreign" interfaces, and I am taking the 0th step in an interface of Reduce to the NLopt package.  So far, I have in a file "nlopt.red" the following:



module nlopt;

#if (memq 'csl lispsystem!*)

fluid '(nlopt_lib!*);
fluid '(nlopt_version!*);
fluid '(nlopt_ld_mma!*);
 
% patterned after packages/foreign/gurobi/gurobi.red:
nlopt_lib!* := open!-foreign!-library "/opt/nlopt/lib/libnlopt.so";
% nlopt_lib!* := lto_sconcat {rltools_trunk(), "packages/foreign/nlopt/libnlopt.so"};

nlopt_version := find!-foreign!-function("nlopt_version", nlopt_lib!*);
nlopt_ld_mma  := find!-foreign!-function("NLOPT_LD_MMA", nlopt_lib!*);

procedure nlopt_version();
   begin scalar major,minor,bugfix;
      % NLOPT_EXTERN(void) nlopt_version(int *major, int *minor, int *bugfix);
      call!-foreign!-function(nlopt_version!*, 'int32, major, 'int32, minor,
      'int32, bugfix);
      return {major,minor,bugfix};
   end;

procedure nlopt_ld_mma();
   begin
%      call!-foreign!-function(nlopt_ld_mma!*, ...)
   end;

#endif
endmodule;  % nlopt


Here I am attempting just to test the NLopt "nlopt_version" routine. If anyone wants to comment on this, point out problems, etc, I would be happy to hear. 

My question for the moment is: how do I test this with CSL Reduce?  Do I have to put this file in packages/foreign/nlopt/ and rebuild Reduce? Since I am going to be adding more functions and doing repeated testing, I would like to avoid having to rebuild Reduce every time.

                                                Kostas