i tried call cpp code in dart but failed
import 'dart:ffi' as ffi;
import 'package:ffi/ffi.dart' as pkgffi;
void main(List<String> arguments) {
try {
ffi.DynamicLibrary dynamicLibrary = ffi.DynamicLibrary.open("./lib.so");
var res = dynamicLibrary.lookupFunction<ffi.Void Function(), void Function()>("play").call();
} catch (e) {
print(e);
}
}
#include <iostream>
#include <stdio.h>
void play()
{
using namespace std;
cout << "Come up and C++ me some" << endl;
}
command compile librarys
g++ lib.cpp -o lib.so -fPIC --shared
error message
Invalid argument(s): Failed to lookup symbol 'play': ./azka.so: undefined symbol: play
can you help me to call function play in dart?