structify_pro 1.0.0 copy "structify_pro: ^1.0.0" to clipboard
structify_pro: ^1.0.0 copied to clipboard

discontinuedreplaced by: structify

A Dart package that allows you to create and use structs.

example/structify_pro_example.dart

import 'dart:ffi';

import 'package:structify_pro/structify_pro.dart';

class MyStruct extends Struct {
  @override
  Pointer toCStruct() {
    // TODO: Implement conversion to a C++ struct
    return nullptr;
  }

  @override
  void fromCStruct(Pointer ptr) {
    // TODO: Implement conversion from a C++ struct
  }
}

void main() {
  // Create a MyStruct instance
  final myStruct = MyStruct();

  // Convert the MyStruct instance to a C++ struct
  final cStruct = myStruct.toCStruct();

  // Convert the C++ struct back to a MyStruct instance
  myStruct.fromCStruct(cStruct);

  // Load a dynamic library
  final library = loadLibrary('my_library');

  // Look up a function in the dynamic library
  final function =
      lookupFunction<NativeFunction<Void Function()>>(library, 'my_function');
  // Convert the function pointer to a Dart function
  final dartFunction = function.asFunction<Void Function()>();

  // Call the Dart function
  dartFunction();
}
2
likes
140
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart package that allows you to create and use structs.

Documentation

API reference

License

MIT (license)

More

Packages that depend on structify_pro