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

  • SEARCH
  • Home
  • 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 6001033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:46:42+00:00 2026-05-23T00:46:42+00:00

this is a follow-up post of Using pHash from .NET How would you declare

  • 0

this is a follow-up post of Using pHash from .NET

How would you declare following C++ declaration in .NET?

int ph_dct_imagehash(const char* file,ulong64 &hash);

So far i have

[DllImport(@"pHash.dll")]
public static extern int ph_dct_imagehash(string file, ref ulong hash);

But I am now getting following error for

ulong hash1 = 0, hash2 = 0;
string firstImage = @"C:\Users\dance2die\Pictures\2011-01-23\177.JPG";
string secondImage = @"C:\Users\dance2die\Pictures\2011-01-23\176.JPG";
ph_dct_imagehash(firstImage, ref hash1);
ph_dct_imagehash(secondImage, ref hash2);

enter image description here

It basically says that my declartion of ph_dtc_imagehash is wrong.

What am I doing wrong here?

  • 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-23T00:46:43+00:00Added an answer on May 23, 2026 at 12:46 am

    Stack imbalance indicates that the C++ code uses cdecl and your C# uses stdcall calling convention. Change your DLLImport to this:

    [DLLImport(@"pHash.dll", CallingConvention=CallingConvention.Cdecl)]
    

    The function signature in C# (return value and parameters) is otherwise correct.

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

Sidebar

Related Questions

This is a follow up post to some problems I've had using Java built
(Somewhat of a follow on from the post (which remains unanswered): https://stackoverflow.com/q/6197829/314661 ) Using
This is a follow up to my previous question about using XMLHttpRequest() to post
This is a follow up of this [post] Ada: Adding an exception in a
This is a follow-up question related to my previous post . Below is a
This post if a follow-up question to mt previous post: Android RESTful Web application
Trying to follow this example. (Section String sorting...) Is there anything obvious that would
I am trying to follow this example (from p137 of Rob Pickering's Foundations of
Follow-up to post: Using * Width & Precision Specifiers With boost::format I'm trying to
As a follow on from this question I'm building a custom server control to

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.