Python Forum
Help Wrapping C Library - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Help Wrapping C Library (/thread-20999.html)



Help Wrapping C Library - LeftyGuitar - Sep-10-2019

Hello,

I am trying to wrap the Sigil library, which was written in C. I have had success wrapping it in other languages such as Ruby and Euphoria, however with Python I keep hitting roadblocks.

sigil.slWindow.argtypes = [ctypes.c_int,ctypes.c_int,ctypes.c_wchar_p,ctypes.c_int]
sigil.slWindow.restype = None

sigil.slClose.argtype = None
sigil.slClose.restype = None

sigil.slShouldClose.argtype = None
sigil.slShouldClose.restype = ctypes.c_bool

def slWindow(width,height,title,fullScreen):
    return sigil.slWindow(width,height,title,fullScreen)

def slClose():
    return sigil.slClose()

sigil.slRender.argtype = None
sigil.slRender.restype = None

def slRender():
    return slRender()


def slShouldClose():
    return sigil.slShouldClose()

slWindow(640,480,"Hello World",0) #only the H is printed in the title screen

while not slShouldClose():
       slRender()
The window shows up, but it only shows a white screen when it should be blank(black) and I can't close the window, I have to use CTRL+ALT+DELETE to close the window.


RE: Help Wrapping C Library - LeftyGuitar - Oct-01-2019

*BUMP*


RE: Help Wrapping C Library - micseydel - Oct-06-2019

This is the kind of question where I think that we need to be able to fully reproduce it to investigate robustly. Assuming your code is more than a short script, I recommend getting your code on Github with clear instructions for how to reproduce this issue. Also note, I'm not certain that people will be willing to do in and help, but given that you haven't gotten a response for nearly a month and bumped nearly a week ago, I think that's your best bet.