From d56e04c006980a09aa0a224162e1b0e27eeda36a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 28 Jan 2025 01:31:14 +0100 Subject: [PATCH] Use explicit init on DLL --- lib/adbc_dll_loader_nif.ex | 3 +-- lib/adbc_nif.ex | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/adbc_dll_loader_nif.ex b/lib/adbc_dll_loader_nif.ex index f70a27a..1570077 100644 --- a/lib/adbc_dll_loader_nif.ex +++ b/lib/adbc_dll_loader_nif.ex @@ -4,8 +4,7 @@ defmodule Adbc.DLLLoaderNif do # @on_load the order is not guaranteed in a release. @moduledoc false - @on_load :load_nif - def load_nif do + def init do case :os.type() do {:win32, _} -> priv_dir = :code.priv_dir(:adbc) diff --git a/lib/adbc_nif.ex b/lib/adbc_nif.ex index 308ca3d..15195ea 100644 --- a/lib/adbc_nif.ex +++ b/lib/adbc_nif.ex @@ -3,7 +3,7 @@ defmodule Adbc.Nif do @on_load :load_nif def load_nif do - :ok = Adbc.DLLLoaderNif.add_dll_directory() + :ok = Adbc.DLLLoaderNif.init() nif_file = ~c"#{:code.priv_dir(:adbc)}/adbc_nif" case :erlang.load_nif(nif_file, 0) do