euantorano / serial.nim

A Nim library for accessing serial ports.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undeclared identifier: 'PCustomOverlapped'

bitnom opened this issue · comments

nim: 1.2.6 win32

code:

import serial

for port in listSerialPorts():
    echo port

error:

.nimble\pkgs\serial-1.1.4\serial\private\serialport\serialport_windows.nim(637, 12) Error: undeclared identifier: 'PCustomOverlapped'

Looks like there must have been a change in Nim. The PCustomOverlapped type used to be declared in asyncdispatch but there’s no reference to it now and I can’t find it using GitHub search either...

Just found the commit: nim-lang/Nim@7626907#diff-e7d29941cb2ca6bf4e0f5c627239bc7b

Are you using Nim devel?

Looks like I will need to re-think the asynchronous support.

I found similar issue with nim-1.2.6_x64 on windows10 64bit.

  1. these code works:
    import serial/utils
    for port in listSerialPorts():
    echo port

  2. these code report errors:
    import serial/utils, serial/serialport
    for port in listSerialPorts():
    echo port
    let port = newSerialPort("COM5")

.nimble\pkgs\serial-1.1.4\serial\private\serialport\serialport_windows.nim(637, 12) Error: undeclared identifier: 'PCustomOverlapped'

I checked with different nim versions by choosenim tool, and found 1.0.8 is OK, details:
1.2.6 - NG(Not Good)
1.2.4 - NG
1.2.2 - NG
1.2.0 - NG
1.0.8 - OK

@leeooox Any chance you could give #45 a try? I don't currently have access to a Windows machine to test with.

Never mind, I found a Windows machine and gave it a go - seems to fix the problem 😄 Will tag a new release later after dinner.

@euantorano Thanks for fixing the issue, I double check it works on my win10 64bit PC with Nim 1.2.6