feat: add dynamic library build
This commit is contained in:
29
src/lib/libncmdump.cpp
Normal file
29
src/lib/libncmdump.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "ncmcrypt.h"
|
||||
|
||||
#define API __declspec(dllexport)
|
||||
|
||||
extern "C" {
|
||||
API NeteaseCrypt* CreateNeteaseCrypt(const char* path) {
|
||||
return new NeteaseCrypt(std::string(path));
|
||||
}
|
||||
|
||||
API int Dump(NeteaseCrypt* neteaseCrypt) {
|
||||
try
|
||||
{
|
||||
neteaseCrypt->Dump();
|
||||
}
|
||||
catch (const std::invalid_argument& e)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
API void FixMetadata(NeteaseCrypt* neteaseCrypt) {
|
||||
neteaseCrypt->FixMetadata();
|
||||
}
|
||||
|
||||
API void DestroyNeteaseCrypt(NeteaseCrypt* neteaseCrypt) {
|
||||
delete neteaseCrypt;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user