Foreign.Marshal.Unsafe

Foreign.Marshal.Unsafe

Copyright (c) The FFI task force 2003
License BSD-style (see the file libraries/base/LICENSE)
Maintainer ffi@haskell.org
Stability provisional
Portability portable
Safe Haskell Unsafe
Language Haskell2010

Contents

Description

Marshalling support. Unsafe API.

Unsafe functions

unsafeLocalState :: IO a -> a Source

Sometimes an external entity is a pure function, except that it passes arguments and/or results via pointers. The function unsafeLocalState permits the packaging of such entities as pure functions.

The only IO operations allowed in the IO action passed to unsafeLocalState are (a) local allocation (alloca, allocaBytes and derived operations such as withArray and withCString), and (b) pointer operations (Foreign.Storable and Foreign.Ptr) on the pointers to local storage, and (c) foreign functions whose only observable effect is to read and/or write the locally allocated memory. Passing an IO operation that does not obey these rules results in undefined behaviour.

It is expected that this operation will be replaced in a future revision of Haskell.

© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/7.10.3/docs/html/libraries/base-4.8.2.0/Foreign-Marshal-Unsafe.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部