Posted By: MatAllum
[FIXED] Unable to import Win32 function (spoiler: I'm dumb) - 07/03/16 15:39
Trying to point my game towards a reasonable save directory by way of GetEnvironmentVariable here, without much luck. Per instructions on the manual (and guidance from Microsoft's documentation), I added this code near the top of my script:
However, while this combination does compile without giving me any syntax errors (or telling me it's not in the DLL), it apparently does not manage to import, as when I try to call it in main(), I get the error "Empty function called":
Am I missing something here? Or is there a better way to point my save_dir to an acceptable location?
Code:
#include <windows.h> DWORD WINAPI GetEnvironmentVariable(char* lpName, char* lpBuffer, DWORD nSize); #define PRAGMA_API GetEnvironmentVariable;kernel32!GetEnvironmentVariableA
However, while this combination does compile without giving me any syntax errors (or telling me it's not in the DLL), it apparently does not manage to import, as when I try to call it in main(), I get the error "Empty function called":
Code:
str_cpy(save_dir, ""); GetEnvironmentVariable("AllUsersProfile", _chr(save), 128); str_cat(save, "\\[game name redacted]"); CreateDirectory(_chr(profileTempStr), 0);
Am I missing something here? Or is there a better way to point my save_dir to an acceptable location?