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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:28:03+00:00 2026-06-02T19:28:03+00:00

There is a function from a DLL (C language) link(parameters, &connection); which takes a

  • 0

There is a function from a DLL (C language) link("parameters", &connection); which takes a string parameter and initializes a connection.

There is a function connect(connection), where connection is the object initialized with a call to link().

I pass Python connection object to function connect() as an argument

connection_t = ctypes.c_uint32
link = mydll.link
link.argtypes=(ctypes.c_char_p, ctypes.POINTER(connection_t) )
connect = mydll.connect
connect.argtypes=(connection_t,)
...
connection = connection_t()
link ("localhost: 5412", ctypes.byref(connection))
...

But if I transfer the ‘connection’ object to any other function of mydll library, the function returns a value, but the value is incorrect.

func=mydll.func
status_t=ctypes.c_uint32
status=status_t()
func.argtypes=(ctypes.c_ulong,ctypes.POINTER(status_t))
result=func(connection, ctypes.byref(status))

In this example result=0, but in the C-variant of this code I receive a correct value (not 0)

Why?

  • 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-06-02T19:28:04+00:00Added an answer on June 2, 2026 at 7:28 pm

    Based on your comment describing the C apis:

    link(const char* set, conn_type* connection );
    func(conn_type* connection, uint32_t* status);
    

    Since func takes a pointer to a connection type, the code should be something like:

    mydll=ctypes.CDLL('mydll')
    connection_t = ctypes.c_uint32
    link = mydll.link
    link.argtypes=(ctypes.c_char_p, ctypes.POINTER(connection_t) )
    connection = connection_t()
    link("localhost: 5412", ctypes.byref(connection))
    
    func=mydll.func
    status_t=ctypes.c_uint32
    status=status_t()
    func.argtypes=(ctypes.POINTER(connection_t),ctypes.POINTER(status_t))
    result=func(ctypes.byref(connection), ctypes.byref(status))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to call an action script function from an anchor which
I am calling a function from a native .NET dll like this: string v
Is there a function to extract a timespan field from a datetime2 field? e.g
Is there any way to return an array from a function? More specifically, I've
I know there's a function to obtain the hash value from a varchar in
Does anyone know if there is a builtin function for reading from the console
I'm interested if there is any function like array_map or array_walk from php. Don't
Is there any similar peek(); (From C++) function in ruby? Any alternative to do
I have the following piece of code from a book. There is this function
Is there a native PHP function for rejecting invalid $_POST data from simple text

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.