Giter Site home page Giter Site logo

Comments (4)

dcharkes avatar dcharkes commented on July 16, 2024

.ref is an extension method, not an instance method: https://api.dart.dev/stable/3.0.5/dart-ffi/StructPointer/ref.html

Even methods that are instance methods in dart:ffi are often prohibited to be used from dynamic. The reason is that we need to "see" the dart:ffi uses at compile time because it uses a special compilation.

Why do you want to use dynamic? Why not use final testClass = createClass() (or var testClass = ...) and have static typing without having to write the type?

from ffi.

millie-molly avatar millie-molly commented on July 16, 2024

I found same issue 123

My understanding is that class is not part of ABI, so change class to struct from header file.

Is it right?

BTW, static variable ( using final ) returns same error.

from ffi.

dcharkes avatar dcharkes commented on July 16, 2024

I found same issue 123

This is a different issue from what you were asking earlier, correct?

Earlier you were asking about using dynamic in Dart, and now you are asking about C++ classes with FFI.

My understanding is that class is not part of ABI, so change class to struct from header file.

Is it right?

Correct, structs are a C concept.

BTW, static variable ( using final ) returns same error.

The same as dynamic? That is very weird because with final it should have the correct type and be able to resolve .ref to the extension method.

from ffi.

millie-molly avatar millie-molly commented on July 16, 2024

Alright, I try to change it.
And since ### final cannot find a correct type, I think return the same error.
Anyway, thanks to help me I appreciate it.

from ffi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.