[clean-list] htoclean sorrows

John van Groningen johnvg at cs.ru.nl
Tue May 30 17:59:07 MEST 2006


Matthew Bromberg wrote:
>Thank you for this information.  I have verified that the atlas .dll library files are definately in ccall format. No doubt all the
>other C compatible blas libraries are in this format as well.  Now the strange thing
>is that due to the limitations of the various library tools it is not really possible to get them into a stdcall format in what I'd
>call a finite amount of time.  One could ask the question, how would you fix a third party .dll that uses a cdecl calling convention so that it works with clean?

You don't have to. If you use ccall without a P at the beginning, the compiler
will use the cdecl calling convention. This should also work if the other function is in a dll.

For example if I compile:

module daxpy

import StdEnv

import code from library "libacm_library";

daxpy :: !Int !Real !{#Real} !Int !{#Real} !Int -> Int;
daxpy nlen alpha x x_d y y_d = code {
	ccall daxpy "IRAIAI:I"
}

rmac :: !Real !{#Real} !{#Real} -> {#Real};
rmac a x y
	# n = daxpy (size x) a x 1 y 1;
	| n==n
		= y;

Start
	= (
		rmac 2.0 {0.5, -0.5, 1.0, -1.0} { 1.0,  2.0,  3.0 , 4.0},
		rmac 3.0 {0.5, -0.5, 1.0, -1.0} {11.0, 12.0, 13.0, 14.0}
	)



With file libacm_library in the Clean System Files folder consisting of:

libacml.dll
daxpy


The program calls the daxpy function in the acml library from amd,
and prints the correct results (on windows xp x64).

Kind regards,

John van Groningen



More information about the clean-list mailing list