Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 518093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:54:06+00:00 2026-05-13T07:54:06+00:00

platform : win32 , language : c++ I get this error when I call

  • 0

platform : win32 , language : c++

I get this error when I call an imported function I declared:

Run-Time Check Failure #0 – The value of ESP was not properly saved
across a function call. This is
usually a result of calling a function
declared with one calling convention
with a function pointer declared with
a different calling convention.

And this is the code I used:

int LoadSongFromFile(int module);
typedef int (CALLBACK* loadSongT)(LPCTSTR);

//...

HINSTANCE dllHandle = NULL;
loadSongT loadSongPtr = NULL;

dllHandle = LoadLibrary(L"miniFMOD.dll");
loadSongPtr = (loadSongT)GetProcAddress(dllHandle,"SongLoadFromFile");

int songHandle = loadSongPtr(L"C:\b.xm");

The function I’m trying to call is SongLoadFromFile which requires one argument (in C# it is string so I assume its LPCTSTR in C++) and returns an int value.

Can somebody check what have I done wrong?

P.S. songHandle gets a weird negative value of -858993460

This is how I can call that function from C# :

[DllImport("MiniFMOD.dll")] public static extern int SongLoadFromFile(string name);

P.S. 2 : Using *typedef int (__cdecl loadSongT)(char);* doesn’t return an error but songHandle comes up as 0.

miniFMOD.dll is an unmanaged library

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:54:07+00:00Added an answer on May 13, 2026 at 7:54 am

    I think the other people are misunderstanding the question. It seems to me that minifmod.dll is a native library that exports a function named SongLoadFromFile. The existing code that calls this is managed code (C#) that uses DllImport to call the function in the native DLL. From what little information I could gather by a few Google searches, it looks as though it should be declared as follows:

    typedef int (__cdecl * SongLoadFromFileT)(const char*);
    

    Importantly, it is __cdecl calling convention and it takes an ANSI string instead of a Unicode string.

    As an aside, I find it strange that I can’t find ANYTHING on minifmod.dll other than a few forum posts on a Russian website and some SO questions from this guy. The only “legitimate” information I can find on minifmod is a small static library with similar functionality. I wonder if minifmod.dll is some kind of commercialized version of the static library; at least that would explain why there is not much public documentation about it.

    Ah, I found it; it is a Delph port of minifmod (http://www.cobans.net/minifmod.php).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 288k
  • Answers 288k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The way you've defined it, I believe it is done… May 13, 2026 at 5:25 pm
  • Editorial Team
    Editorial Team added an answer Memory manager is not required to release the memory your… May 13, 2026 at 5:25 pm
  • Editorial Team
    Editorial Team added an answer This is ksh88 on an HP-UX machine: me@host ..dev/ $… May 13, 2026 at 5:25 pm

Related Questions

I'm trying to find a programming language I feel really comfortable learning and using
I've spent today looking into lockless queues. I have a multiple producer, multiple consumer
I want to automate several tasks (eg. simulate eclipse style ctrl - shift -
On a cross-platform project, I want to #include a header file whose name contains
I have a char array in a C application that I have to split

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.