Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sys_GetProcAddress - Build failed on MinGW32 #1003

Open
SmileYzn opened this issue Aug 26, 2024 · 0 comments
Open

Sys_GetProcAddress - Build failed on MinGW32 #1003

SmileYzn opened this issue Aug 26, 2024 · 0 comments

Comments

@SmileYzn
Copy link

Sys_GetProcAddress - Build failed on MinGW32

https://github.com/s1lentq/ReGameDLL_CS/blob/dc16b12d7976f03d20b81f9a2491ee7dddbb9b8e/regamedll/public/interface.cpp#L110

Maybe change to:

// Purpose: returns a pointer to a function, given a module
// Input  : pModuleName - module name
//			*pName - proc name
//static hlds_run wants to use this function
void *Sys_GetProcAddress(const char *pModuleName, const char *pName)
{
	return (void*)GetProcAddress(GetModuleHandle(pModuleName), pName);
}

// Purpose: returns a pointer to a function, given a module
// Input  : pModuleName - module name
//			*pName - proc name
// hlds_run wants to use this function
void *Sys_GetProcAddress(void *pModuleHandle, const char *pName)
{
	return (void*)GetProcAddress((HMODULE)pModuleHandle, pName);
}
In file included from ReAPI.cpp:4:
include/cssdk/public/interface.cpp: In function 'void* Sys_GetProcAddress(const char*, const char*)':
include/cssdk/public/interface.cpp:112:30: error: invalid conversion from 'FARPROC' {aka 'int (__attribute__((stdcall)) *)()'} to 'void*' [-fpermissive]
  112 |         return GetProcAddress(GetModuleHandle(pModuleName), pName);
      |                ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              FARPROC {aka int (__attribute__((stdcall)) *)()}
include/cssdk/public/interface.cpp: In function 'void* Sys_GetProcAddress(void*, const char*)':
include/cssdk/public/interface.cpp:121:30: error: invalid conversion from 'FARPROC' {aka 'int (__attribute__((stdcall)) *)()'} to 'void*' [-fpermissive]
  121 |         return GetProcAddress((HMODULE)pModuleHandle, pName);
      |                ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              FARPROC {aka int (__attribute__((stdcall)) *)()}
mingw32-make[1]: *** [Makefile:62: Release/ReAPI.o] Error 1

It will solve the problem to use CSSDK on MinGW32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant