-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The right way to compile as DLL / Invoke from other languages #182
Comments
Hello @LSXAxeller ! Thanks for reaching out and raising this issue! I have not exported the functions using DLL export, like this: #ifdef EXPORTING_BARK
#define BARK_API __declspec(dllexport)
#else
#define BARK_API __declspec(dllimport)
#endif
extern "C" {
BARK_API ContextParams bark_context_default_params();
} Could you open a PR to export the functions you'd like to use? You only need to do it for the Bark library. |
Thanks for your answer @PABannier. I don't code in C++, so I'm not sure if I'm on the right track. I haven't opened a PR because I wanted to check with you first to make sure my edits wouldn't cause any harm. Is that the right approach? I assume that the file I should edit is the Header.
|
I want to build the library as .dll instead .lib to invoke it from C# using P/Invoke but I can't build it properly.
When I set the library to
SHARED
insteadSTATIC
inCMakeFileList.txt
it produced a 11KB bark.dll which doesn't have any entry points.when I tried to open
bark.sln
and set projects propertiesConfiguration Type
toDynamic Library (.dll)
and setCommon Language Runtime Support
to.NET Runtime Support (/clr:netcore)
and setTarget Framework
to.NET 8.0
and compile I get 45KB bark.dll in release.after I move bark.dll & encodec.lib & ggml.dll to my C# console app folder and do P/Invoke using DllImport and call a method like
bark_context_default_params
usingI get error
System.EntryPointNotFoundException: Unable to find an entry point named 'bark_context_default_params' in DLL.
The text was updated successfully, but these errors were encountered: