mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-07 16:21:01 +08:00
Explicitly exporting Python binding functions in Windows
This commit is contained in:
@@ -6,12 +6,20 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
// Microsoft
|
||||||
|
#define OPENALPR_EXPORT __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
// do nothing
|
||||||
|
#define OPENALPR_EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace alpr;
|
using namespace alpr;
|
||||||
|
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
static Alpr* nativeAlpr;
|
static Alpr* nativeAlpr;
|
||||||
|
|
||||||
void initialize(char* ccountry, char* cconfigFile, char* cruntimeDir)
|
OPENALPR_EXPORT void initialize(char* ccountry, char* cconfigFile, char* cruntimeDir)
|
||||||
{
|
{
|
||||||
//printf("Initialize");
|
//printf("Initialize");
|
||||||
|
|
||||||
@@ -30,7 +38,7 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void dispose()
|
OPENALPR_EXPORT void dispose()
|
||||||
{
|
{
|
||||||
//printf("Dispose");
|
//printf("Dispose");
|
||||||
initialized = false;
|
initialized = false;
|
||||||
@@ -38,7 +46,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool isLoaded()
|
OPENALPR_EXPORT bool isLoaded()
|
||||||
{
|
{
|
||||||
//printf("IS LOADED");
|
//printf("IS LOADED");
|
||||||
|
|
||||||
@@ -49,7 +57,7 @@ extern "C" {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* recognizeFile(char* cimageFile)
|
OPENALPR_EXPORT char* recognizeFile(char* cimageFile)
|
||||||
{
|
{
|
||||||
//printf("Recognize file");
|
//printf("Recognize file");
|
||||||
|
|
||||||
@@ -68,14 +76,14 @@ extern "C" {
|
|||||||
return membuffer;
|
return membuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void freeJsonMem(char* ptr)
|
OPENALPR_EXPORT void freeJsonMem(char* ptr)
|
||||||
{
|
{
|
||||||
//printf("freeing address: %p\n", ptr);
|
//printf("freeing address: %p\n", ptr);
|
||||||
free( ptr );
|
free( ptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* recognizeArray(unsigned char* buf, int len)
|
OPENALPR_EXPORT char* recognizeArray(unsigned char* buf, int len)
|
||||||
{
|
{
|
||||||
//printf("Recognize byte array");
|
//printf("Recognize byte array");
|
||||||
//printf("buffer pointer: %p\n", buf);
|
//printf("buffer pointer: %p\n", buf);
|
||||||
@@ -95,7 +103,7 @@ extern "C" {
|
|||||||
return membuffer;
|
return membuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDefaultRegion(char* cdefault_region)
|
OPENALPR_EXPORT void setDefaultRegion(char* cdefault_region)
|
||||||
{
|
{
|
||||||
// Convert strings from java to C++ and release resources
|
// Convert strings from java to C++ and release resources
|
||||||
std::string default_region(cdefault_region);
|
std::string default_region(cdefault_region);
|
||||||
@@ -103,17 +111,17 @@ extern "C" {
|
|||||||
nativeAlpr->setDefaultRegion(default_region);
|
nativeAlpr->setDefaultRegion(default_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDetectRegion(bool detect_region)
|
OPENALPR_EXPORT void setDetectRegion(bool detect_region)
|
||||||
{
|
{
|
||||||
nativeAlpr->setDetectRegion(detect_region);
|
nativeAlpr->setDetectRegion(detect_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTopN(int top_n)
|
OPENALPR_EXPORT void setTopN(int top_n)
|
||||||
{
|
{
|
||||||
nativeAlpr->setTopN(top_n);
|
nativeAlpr->setTopN(top_n);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* getVersion()
|
OPENALPR_EXPORT char* getVersion()
|
||||||
{
|
{
|
||||||
std::string version = nativeAlpr->getVersion();
|
std::string version = nativeAlpr->getVersion();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user