[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Pkg-haskell-maintainers] libffi changes - help needed

DISCLAIMER: I do not know haskell! my replies are based on what I have read
while looking at this thread and my knowlege of the arm issue at hand.

Joey Hess wrote:
Steve McIntyre wrote:
Exactly, that's the bit I'm unclear about. Does Haskell even have the
concept of variadic function calls? (I honestly don't know!)

It's nonstandard, but seems it can be done:

I notice that a comment on that page says

"However, because C permits the calling convention to be different for such
functions, a Haskell system will, in general, not be able to make use of
variable argument functions. Hence, their use is deprecated in portable

In other words it seems they anticipated the issue we are having here and
decided to tell people simply not to call variadic functions from portable
haskell code. If some haskell code REALLY needs to call a variadic function
with floating point arguments then either haskell needs to be extended to
provide a safe way to call variadic functions or a non-variadic C wrapper
needs to be written

More generally (thinking wider than haskell) the real problem is if the
programmer knew the function prototype at the time the C code was designed
and built then they probablly wouldn't be using libffi in the first place.
So what really needs to be audited is NOT the C code that calls libffi but
the code (or possiblly data files) writen in languages other than C/C++
(regardless of whether those languages use libffi or make the calls
directly) that calls C functions. If that code is calling variadic
functions then either it needs to be modified to not do that or the
language it is written in needs to be extended to provide a way to safely
call variadic functions.

Such an audit would be a hurculean task and i'm not at all convinced it
would be worthwhile.

Reply to: