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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:14:25+00:00 2026-05-24T00:14:25+00:00

Hi i’m trying to call the CreateFileA win32 function from a pyx file (cython

  • 0

Hi i’m trying to call the CreateFileA win32 function from a pyx file (cython file)(windows.h is already included from the pxd file), but it doesn’t work … does anyone ever tried to do so… needs help please

More informations:
i got no errors when compiling with Mingw, but at the execution i get -1 as return value..

illustration :

myfile.pxd

cdef extern from "ftd2xx.h":

   stuff....

   # CreateFileA declaration

   HANDLE **CreateFileA***(LPCSTR lpFileName, DWORD dwDesiredAccess, 
       DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, 
       DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, 
       HANDLE hTemplateFile)*

myfile.pyx

cimport myfile.pxd

def somefuction()
HANDLE a = myfile.**CreateFileA**(......)

at the execution i get -1

  • 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-24T00:14:26+00:00Added an answer on May 24, 2026 at 12:14 am

    Negative 1 (-1 return) means there were multiple errors. It’s possible that you are including from the wrong place.

    Anyway, my python experience tells me that you can use win32all, from Mark Hammond, to call the win32api. That should solve all your problems.

    If it doesn’t:

    I snooped around Stack Overflow and found lots of people had similar problems. Here are some things you can try:

    mingw_setup_args={'options': {'build_ext': {'compiler': 'mingw32'}}}
    import pyximport; pyximport.install(setup_args=mingw_setup_args)

    Browse to: c:\Python2x\Lib\distutils\distutils.cfg:

    [build]
    compiler = mingw32
    
    [build_ext]
    compiler = mingw32
    

    I encourage you to branch out. If you notice the right sidebar, “related” div on this page, you’ll see that there are many people who have asked similar questions. I hope it gets you started. Alternatively, I recommend you look for a better compiler–something that will give you a full error report. Post the error report here. Try to be as precise as possible if there’s anything you want to exclude, so that you remove as little helpful data as possible. You can definitely find a solution if one exists, provided you find a complete error message.

    I’m almost certain that a full error report exists somewhere, and you just don’t know where to look. I found out very early in my programming career that this is always the case when it seems there’s “no error” to a programmer: they’re looking in the wrong place. So, you should figure out where to look for a complete error report.

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to construct a data frame in an Rcpp function, but when I
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.