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

Update LoadLibrary.c #8358

Merged
merged 1 commit into from
Oct 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions samples/NativeLibrary/LoadLibrary.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@

#ifdef _WIN32
#include "windows.h"
#define symLoad GetProcAddress GetProcAddress
#define symLoad GetProcAddress
#else
#include "dlfcn.h"
#include <unistd.h>
#define symLoad dlsym
#endif
#include <unistd.h>

#include <stdlib.h>
#include <stdio.h>

#ifndef F_OK
#define F_OK 0
#endif

int callSumFunc(char *path, char *funcName, int a, int b);
char *callSumStringFunc(char *path, char *funcName, char *a, char *b);

Expand Down Expand Up @@ -46,7 +51,7 @@ int callSumFunc(char *path, char *funcName, int firstInt, int secondInt)
{
// Call sum function defined in C# shared library
#ifdef _WIN32
HINSTANCE handle = LoadLibrary(path);
HINSTANCE handle = LoadLibraryA(path);
#else
void *handle = dlopen(path, RTLD_LAZY);
#endif
Expand All @@ -65,7 +70,7 @@ char *callSumStringFunc(char *path, char *funcName, char *firstString, char *sec
{
// Library loading
#ifdef _WIN32
HINSTANCE handle = LoadLibrary(path);
HINSTANCE handle = LoadLibraryA(path);
#else
void *handle = dlopen(path, RTLD_LAZY);
#endif
Expand Down