Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Win32API with Fiddle, update appveyor.yml #1053

Merged
merged 2 commits into from
Oct 2, 2019

Conversation

MSP-Greg
Copy link
Contributor

@MSP-Greg MSP-Greg commented Jun 15, 2019

My fork's Appveyor build passed and is at:
https://ci.appveyor.com/project/MSP-Greg/mysql2/builds/25306388

@sodabrew
Copy link
Collaborator

I remember doing it this way because Win32API is in core. Is it deprecated/removed and is Fiddle bundled with core now? At which Ruby does this change? (In other words what revisions are being left behind?)

@MSP-Greg
Copy link
Contributor Author

I remember doing it this way because Win32API is in core

I think it's always been part of the std-lib.

Is it deprecated/removed

See ext/win32/lib/Win32API.rb:5. I haven't gone all the way back, but also see ruby/ruby@dd3aec2.

Then again, I've joked about it, given that it's been deprecated for a very long time.

Win32API uses Fiddle. Really, I'm just tired of seeing warning messages...

LoadLibrary = Win32API.new('Kernel32', 'LoadLibrary', ['P'], 'I')
if LoadLibrary.call(dll_path).zero?
require 'fiddle'
kernel32 = Fiddle.dlopen 'kernel32'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should still be initial cap Kernel32 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Umm, not reusing it are we?

Copy link
Collaborator

@sodabrew sodabrew Jul 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the library:Win32API.new('Kernel32', ...
vs. Fiddle.dlopen 'kernel32'

Maybe irrelevant because of case insensitivity? But if there's a "correct" convention I'd like to use that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. between multi-tasking & bouncing between languages, I often miss the obvious.

Actually, the file is kernel32.dll, and as you know, Windows file system is case-insensitive (which can cause issues when comparing paths, use casecmp...)

Also, ruby/reline essentially created its own Win32API class to avoid the deprecation warnings, and it's all lower case. See lib/reline/windows.rb

Long story short, I think we're ok...

@sodabrew
Copy link
Collaborator

Looks like Fiddle is core as far back as Ruby 2.0: https://ruby-doc.org/stdlib-2.0.0/libdoc/fiddle/rdoc/Fiddle.html

Meanwhile, I knew there was some history in my memory banks around Win32API: ruby/ruby#835

See also #584

Since the issue came up in the mysql2 0.3.x series, continuing to use Win32API must have been to continue supporting Ruby 1.8/1.9 (without Fiddle in core). Since those versions are no longer supported I see no reason not to switch.

I am reminded to get a release out...

@MSP-Greg
Copy link
Contributor Author

Note to self - ALWAYS USE 'W' VERSIONS...

Some users may have UTF-8 characters in their user names... Updated. Passing Appveyor build

@sodabrew sodabrew added this to the 0.5.3 milestone Oct 2, 2019
@sodabrew sodabrew merged commit fd32e28 into brianmario:master Oct 2, 2019
@MSP-Greg MSP-Greg deleted the no-Win32API branch February 25, 2020 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants