Created
July 13, 2011 22:07
-
-
Save jayemerson/1081448 to your computer and use it in GitHub Desktop.
function loading up front
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NQR/src/nqr.pir | |
.sub '' :anon :load | |
load_bytecode 'HLL.pbc' | |
... # OMITTED STANDARD squaak STUFF | |
# ATTEMPTED LIBRARY LOADING UP FRONT? | |
.local pmc lib, nci | |
loadlib lib, 'libgsl.so' | |
dlfunc nci, lib, 'gsl_ran_gaussian_pdf', 'ddd' | |
set_global ['GSL'], 'gsl_ran_gaussian_pdf', nci | |
.end | |
## NQR/src/nqr/Runtime.pm: dnorm() works, dnorm2() does not work | |
sub dnorm(*@args) { | |
return Q:PIR { | |
.local num ans | |
.local pmc gsl_ran_gaussian_pdf | |
gsl_ran_gaussian_pdf = get_global ["GSL"], 'gsl_ran_gaussian_pdf' | |
ans = gsl_ran_gaussian_pdf(0.5, 1.0) | |
%r = box ans | |
}; | |
} | |
# doesn't work. Error: invoke() not implemented in class 'Undef' | |
sub dnorm2(*@args) { | |
return Q:PIR { | |
.local pmc libgsl, gsl_ran_gaussian_pdf | |
.local num ans | |
libgsl = loadlib "libgsl" | |
gsl_ran_gaussian_pdf = dlfunc libgsl, "gsl_ran_gaussian_pdf", "ddd" | |
ans = gsl_ran_gaussian_pdf(0.5, 1.0) | |
%r = box ans | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment