Skip to content

Commit

Permalink
Revert ddl load nif changes on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jan 28, 2025
1 parent c7003cf commit fcbf7fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/adbc_dll_loader_nif.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ defmodule Adbc.DLLLoaderNif do
# @on_load the order is not guaranteed in a release.
@moduledoc false

def init do
@on_load :load_nif
def load_nif do
case :os.type() do
{:win32, _} ->
priv_dir = :code.priv_dir(:adbc)
Expand All @@ -19,6 +20,9 @@ defmodule Adbc.DLLLoaderNif do
end

def add_dll_directory do
:erlang.nif_error(:not_loaded)
case :os.type() do
{:win32, _} -> :erlang.nif_error(:not_loaded)
_ -> :ok
end
end
end
2 changes: 1 addition & 1 deletion lib/adbc_nif.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Adbc.Nif do

@on_load :load_nif
def load_nif do
:ok = Adbc.DLLLoaderNif.init()
:ok = Adbc.DLLLoaderNif.add_dll_directory()
nif_file = ~c"#{:code.priv_dir(:adbc)}/adbc_nif"

case :erlang.load_nif(nif_file, 0) do
Expand Down

0 comments on commit fcbf7fd

Please sign in to comment.