Skip to content

Sys_GetProcAddress - Build failed on MinGW32 #328

Open

Description

@SmileYzn

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions