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 6558241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:10:31+00:00 2026-05-25T13:10:31+00:00

I am trying to access my function in a dll and pass by value

  • 0

I am trying to access my function in a dll and pass by value as integer in it. But I am getting a ValueError as:

Procedure probably called with too many arguments (4 bytes in excess)

My python .py script is as below:

func2.restype = c_int
func2.argtypes = [c_int]
func2(3)

…

My actual function in the dll is just a simple function like:

int DLLfun2(int argtest) { return argtest + 1; };

…

Looks like a simple problem, but I’m guessing I am missing out on something. Kindly help.

Cheers.

  • 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-25T13:10:31+00:00Added an answer on May 25, 2026 at 1:10 pm

    Looks weird because integer should be automatically cast, but try with a func2(c_int(3))

    EDIT :
    According to the ctypes doc, this exception could be raised because of a wrong calling convention (cdecl instead of stdcall). But the function is still called (just a sort of warning :s)

    Be sure of you declaration in your dll.

    If you load your library with windll, it must use stdcall calling convention, otherwise, use the cdll module.

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

Sidebar

Related Questions

I'm trying to access an arrays data from inside a function but keep getting
I am trying to access the GetProcAddress function in the kernel32.dll from my C#
I'm trying to access the post target action in a jquery function. example: <form
I am trying to create a function that will block access to some of
I'm trying to make a call to a DLL function (via GetProcAddress etc) from
I'm trying to access some Ghostscript functions like so: [DllImport(@C:\Program Files\GPLGS\gsdll32.dll, EntryPoint = gsapi_revision)]
First of all, I'm not too comfortable with DLL's. I've done them before, but
I'm trying to use the StackWalk64 function in DbgHelp.dll to get a stack trace
Using Delphi XE. When trying to access a Delphi interface object from a DLL,
I'm trying to use Python's ctypes to work with a DLL, but I occasionally

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.