i'm trying to integrate a native c++ library .dll to my flutter desktop app
this is the code from header and cpp (it contain different function but i'm trying to achieve this with a simple hello function)
the header file:
#pragma once
#include <msclr/marshal_cppstd.h>
#pragma managed(push, off)
#include "lz4/lz4frame.h"
#include "fastlz.h"
#pragma managed(pop)
using namespace System;
using namespace System::Collections::Generic;
namespace LSLib {
namespace Native {
public ref class LZ4FrameCompressor abstract sealed
{
public:
static void hello();
};
}
}
the c++ file:
#pragma once
#include "lz4wrapper.h"
#include <string>
#include <iostream>
namespace LSLib {
namespace Native {
void LZ4FrameCompressor::hello() {
std::string strMytestString("hello world");
std::cout << strMytestString;
}
}
}
and this is the code from flutter
final path = absolute(r'native\LSLibNative.dll');
final library = DynamicLibrary.open(path);
final void Function() func = library .lookup<NativeFunction<Void Function()>>('hello').asFunction();
func();
and i'm getting this error:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol 'hello': The specified procedure could not be found.
(error code: 127)
#0 DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:33:70)
#1 LS4Service.initialize (package:bg3_mod_translator/src/infrastructure/ls4_service.dart:22:43)
#2 TranslateComponent.initialize (package:bg3_mod_translator/src/infrastructure/translate_component.dart:50:18)
<asynchronous suspension>
#3 main (package:bg3_mod_translator/main.dart:51:3)
<asynchronous suspension>
i'm not an expert of c++ but i can't undestart what i'm doing wrong any help? thanks!