镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Sundials Types Part I #71

Open
Open

Description

@idontgetoutmuch

I am trying to use sundials via inline-c. I am starting to define the types some of which are quite complex :( Even the simplest seems to throw up problems. For example what should I do here?

#if defined(SUNDIALS_INT64_T)

#if __STDC_VERSION__ >= 199901L
typedef int64_t sunindextype;
#else
typedef long int sunindextype;
#endif

#elif defined(SUNDIALS_INT32_T)

#if __STDC_VERSION__ >= 199901L
typedef int32_t sunindextype;
#else
typedef int sunindextype;
#endif

#endif

At the moment I have this

-- This is a lie!!!
type SunIndexType = CLong

sunTypesTable :: Map.Map CT.TypeSpecifier TH.TypeQ
sunTypesTable = Map.fromList
  [
    (CT.TypeName "sunindextype", [t| SunIndexType |] )
  ]

sunctx = mempty {ctxTypesTable = sunTypesTable}

Activity

  1. idontgetoutmuch commented on Mar 11, 2018

    @idontgetoutmuch
    Author

    Ah but maybe I don't need to do this anyway.

  2. stites commented on Nov 13, 2018

    @stites

    @idontgetoutmuch how did you resolve this?

  3. idontgetoutmuch commented on Nov 14, 2018

    @idontgetoutmuch
    Author

    I don't think I did resolve that particular issue but it's all working - see here: https://github.com/haskell-numerics/hmatrix-sundials/blob/master/src/Numeric/Sundials/Arkode.hsc

  4. ekmett commented on Jun 3, 2019

    @ekmett
    Contributor

    My best work around for this sort of issue is to use hsc2hs and inline-c in the same Haskell module.

    With hsc2hs you can use

    type SunIndexType = #type sunindextype
    

    and then the rest of your code is correct.

  5. idontgetoutmuch commented on Jul 7, 2019

    @idontgetoutmuch
    Author

    👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions