[clean-list] htoclean sorrows
John van Groningen
johnvg at cs.ru.nl
Thu May 11 14:23:24 MEST 2006
Matthew Bromberg wrote:
>I am attempting to link to the acml BLAS .dll in a simple test of the clean FFI. I have a windows XP 64 amd x2
>machine.
>...
>Some things that are missing from this description are the fact that the symbol format has an @number syntax appended to each symbol that is not explained,
A @number is appended for functions that use the stdcall calling convention.
This calling convention is usually used for functions exported by a dll.
The number after @ is the total size in bytes (on the stack) of the arguments
of the function. (4 for each int or pointer and 8 for each double).
>and the menu path to the IDE menus that permit the import of the symbol file and the import of the DLL are tricky to find and frankly I can't be sure I got it correct. Also there is no description of how to add the object file.
The text file that contains the exported functions of the .dll can
be added in menu Project / Project Options after selecting Dynamic Libraries
and button Append. And object file can be added in the same dialog, after
selecting Extra Objects and button Append.
Instead of using this dialog, you can add the files by moving the files to
the 'Clean System Files' folder, and adding the following lines to a .icl
module:
import code from "cmatrix.obj"
import code from library "libacm_library"
The IDE will then search all the 'Clean System Files' in the project for these
files, and pass the files to the linker.
>Here is my import file acml_library:
>libacml_dll.dll
>daxpy at 6
daxpy has 5 integer or pointer arguments and 1 double argument, so
5*4+1*8=28 bytes for the arguments. The label name is therefore daxpy at 28.
You can use the dumpbin command line tool of visual c to list the
names of the exported symbols of the dll, for example:
dumpbin /exports libacm.dll
>..
>y :: *{#Real}
>y = {1.0, 2.0, 3.0, 4.0}
>..
>Start :: (*{#Real}, Int)
>Start
>#! nlen = rmac 2.0 x y
>= (y, nlen)
>
The Start function contains 2 calls of function y, so you won't see
the result of rmac. Moving y to Start prevents this:
Start
# y = {1.0, 2.0, 3.0, 4.0}
#! nlen = rmac 2.0 x y
= (y,nlen)
It would be better to let rmac yield the computed array.
Kind regards,
John van Groningen
More information about the clean-list
mailing list