Download

SteamUserStats() generating crash

Hello everyone,

I have a problem with the Steam API when I try to find a leaderboard.

Looks like SteamUserStats() is not returning what it is meant to.
This is what I am doing:

1 - At the begining:


    CSteamLeaderboards* g_SteamLeaderboards = NULL; // Global variable
    
    ...
    
    	// Initialize Steam
    	bool bRet = SteamAPI_Init();
    
    	// Create the SteamLeaderboards object if Steam was successfully initialized
    	if (bRet)
    	{
    		g_SteamLeaderboards = new CSteamLeaderboards();
    	}

2 - Run* SteamAPI_RunCallbacks()* every tick.

3 - When I try to find the leaderboard:


    if (g_SteamLeaderboards)
    {
    	g_SteamLeaderboards->FindLeaderboard(LEADERBOARD_TIME);
    }

4 - My CSteamLeaderboard.cpp (exactly the same as Spacewar example):


    CSteamLeaderboards::CSteamLeaderboards() : m_CurrentLeaderboard(NULL), m_nLeaderboardEntries(0)
    {
    }
    
    void CSteamLeaderboards::FindLeaderboard(const char *pchLeaderboardName)
    {
    	m_CurrentLeaderboard = NULL;
    
    	SteamAPICall_t hSteamAPICall = SteamUserStats()->FindLeaderboard(pchLeaderboardName); // <---- THE ERROR POINTS TO THIS LINE
    	m_callResultFindLeaderboard.Set(hSteamAPICall, this, &CSteamLeaderboards::OnFindLeaderboard);
    }

This is the crash log I get:

Unknown exception - code c06d007f (first/second chance not available)
KERNELBASE
UE4Editor_EliosisHunt!__delayLoadHelper2() [f:\dd\vctools\delayimp\delayhlp.cpp:386]
UE4Editor_EliosisHunt!_tailMerge_steam_api64_dll()
UE4Editor_EliosisHunt!CSteamAPIContext::Init() [c:\program files\epic games\4.11\engine\source hirdparty\steamworks\steamv137\sdk\public\steam\steam_api_internal.h:92]
UE4Editor_EliosisHunt!CSteamLeaderboards::FindLeaderboard() c:\unreal files\eliosishuntworkspace\eliosishunt\source\eliosishunt\private\csteamleaderboards.cpp:19

What am I doing wrong?

Thanks in advance.

I have the exact problem. However on Linux it works just fine. This is so annoying. Have you made any progress?

Just fixed it by compiling it with that visual c++ thing instead of my fellow friend MinGW.

The guys at steam suggested that my DLLs were not matching my source files version. Which was not my case but it might be yours.