Skip to content

Commit

Permalink
Fix pinvoke string and export
Browse files Browse the repository at this point in the history
  • Loading branch information
shana committed Mar 11, 2024
1 parent 9e0fd10 commit 682e296
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
33 changes: 15 additions & 18 deletions src/platform/dnne.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@
#define DNNE_API DNNE_API_OVERRIDE
#endif

#ifdef DNNE_WINDOWS
#ifdef _WCHAR_T_DEFINED
typedef wchar_t char_t;
#else
typedef unsigned short char_t;
#endif

#define WSTRING std::wstring
#define WIDE(str) L##str
#else
typedef char char_t;
#define WSTRING std::string;
#define WIDE(str) str
#endif

//
// Public exports
//
Expand Down Expand Up @@ -115,24 +130,6 @@ extern DNNE_API void* DNNE_CALLTYPE pinvoke_override(const char *libraryName, co
}
#endif

#ifdef DNNE_WINDOWS
#ifdef _WCHAR_T_DEFINED
typedef wchar_t char_t;
#else
typedef unsigned short char_t;
#endif

#define WSTRING std::wstring
#define WIDE(str) L##str
#else
typedef char char_t;
#define WSTRING std::string;
#define WIDE(str) str
#endif

DNNE_EXTERN_C char_t* pinvoke_override_ptr;
DNNE_EXTERN_C const char_t *propertyKeys[];
DNNE_EXTERN_C const char_t *propertyValues[];


#endif // __SRC_PLATFORM_DNNE_H__
4 changes: 3 additions & 1 deletion src/platform/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,9 @@ static int init_dotnet(const char_t* assembly_path)
return rc;
}

set_runtime_property_value_fptr(cxt, L"PINVOKE_OVERRIDE", pinvoke_override_ptr);
if (pinvoke_override_ptr) {
set_runtime_property_value_fptr(cxt, DNNE_STR("PINVOKE_OVERRIDE"), pinvoke_override_ptr);
}

// Get the load assembly function pointer
rc = get_delegate_fptr(
Expand Down

0 comments on commit 682e296

Please sign in to comment.