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

Update LoadLibrary.c #8358

merged 1 commit into from
Oct 9, 2020

Conversation

drvoss
Copy link
Contributor

@drvoss drvoss commented Oct 6, 2020

Support Visual C++ compiler

@jkotas
Copy link
Member

jkotas commented Oct 6, 2020

Could you please explain the problem that this change is fixing?

@drvoss
Copy link
Contributor Author

drvoss commented Oct 6, 2020

@jkotas
#define symLoad GetProcAddress
The #define statement takes two strings. first identifier and second token-string. The #define line occurs compile error.
ref : https://docs.microsoft.com/en-us/cpp/preprocessor/hash-define-directive-c-cpp?view=vs-2019

#include <unistd.h>
// ..
#ifndef F_OK
#define F_OK    0
#endif

Visual C++ has no unistd.h. It's for linux. So, if It can't find the F_OK definition, defined it.

HINSTANCE handle = LoadLibraryA(path);
The default LoadLibrary defines LoadLibraryW. It takes Unicode as an argument. Path is ansi string. So I fix it LoadLibraryA.
ref : https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryw

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jkotas jkotas merged commit b06c72e into dotnet:master Oct 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants