Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

Commit b06c72e

Browse files
authored
Update LoadLibrary.c (#8358)
1 parent 4ce1c21 commit b06c72e

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

samples/NativeLibrary/LoadLibrary.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,20 @@
99

1010
#ifdef _WIN32
1111
#include "windows.h"
12-
#define symLoad GetProcAddress GetProcAddress
12+
#define symLoad GetProcAddress
1313
#else
1414
#include "dlfcn.h"
15+
#include <unistd.h>
1516
#define symLoad dlsym
1617
#endif
17-
#include <unistd.h>
18+
1819
#include <stdlib.h>
1920
#include <stdio.h>
2021

22+
#ifndef F_OK
23+
#define F_OK 0
24+
#endif
25+
2126
int callSumFunc(char *path, char *funcName, int a, int b);
2227
char *callSumStringFunc(char *path, char *funcName, char *a, char *b);
2328

@@ -46,7 +51,7 @@ int callSumFunc(char *path, char *funcName, int firstInt, int secondInt)
4651
{
4752
// Call sum function defined in C# shared library
4853
#ifdef _WIN32
49-
HINSTANCE handle = LoadLibrary(path);
54+
HINSTANCE handle = LoadLibraryA(path);
5055
#else
5156
void *handle = dlopen(path, RTLD_LAZY);
5257
#endif
@@ -65,7 +70,7 @@ char *callSumStringFunc(char *path, char *funcName, char *firstString, char *sec
6570
{
6671
// Library loading
6772
#ifdef _WIN32
68-
HINSTANCE handle = LoadLibrary(path);
73+
HINSTANCE handle = LoadLibraryA(path);
6974
#else
7075
void *handle = dlopen(path, RTLD_LAZY);
7176
#endif

0 commit comments

Comments
 (0)