proc proto stdcall package=work.proto_ds.cfcns; link 'c:\temp\myfactorial.dll'; int myfactorial(int n) ; run; proc fcmp inlib=work.proto_ds outlib=work.fcmp_ds.sasfcns; function sas_myfactorial(x); return (myfactorial(x)); endsub; quit; options cmplib=(work.proto_ds work.fcmp_ds); data _null_; x=sas_myfactorial(6); put x=; run;