Issues when loading extension commands through instance or device

Hi,
I’m having some trouble when I try to load dynamically an extension command from “vulkan-1.dll”.
I’m developing on Win 10 using Visual Studio.
I get the handle to the Vulkan dll in this way:

HMODULE vulkan_module = LoadLibrary(L"vulkan-1.dll");

From that module, I get this:

vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)GetProcAddress(vulkan_module, “vkGetInstanceProcAddr”);
where I’ve defined:
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;

Then, finally, I get the extension command that I want to use, “vkCmdSetPrimitiveTopologyEXT”,
in this way:
vkCmdSetPrimitiveTopologyEXT = reinterpret_cast<PFN_vkCmdSetPrimitiveTopologyEXT>(vkGetInstanceProcAddr(instance, “vkCmdSetPrimitiveTopologyEXT”));
where:
VkInstance instance = …; // I create this by calling vkCreateInstance(…)

Of course, I checked that the physical device on my system (Quadro M1200, supporting version 1.2.155) does provide this extension:
“VK_EXT_extended_dynamic_state”
and so, it should provide the API I need.
Well, it happens that the above call to get the address of the required API returns an apparently valid pointer
(it is not NULL, neither an apparent invalid pointer): 0x00007ff8e6237180.
But when I try to call it:

vkCmdSetPrimitiveTopologyEXT(VulkanContextGN.commandBuffers[i], VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST);

my application crashes, reporting the classic exception:
0xC0000005: Access violation executing location 0x0000000000000000
How is this possible?
I did verify that VulkanContextGN.commandBuffers[i] is a valid command buffer.
In fact if I do not enable the extended dynamic state when creatign the pipeline, but declare it in the input assemby info:
inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
my application does work correctly using such command buffer.
But I do want to change the topology dynamically, so this is not good for me.

BTW, with validation layers enabled, if I do not call the vkCmdSetPrimitiveTopologyEXT, it reports this error:

Validation layer: Validation Error: [ VUID-vkCmdDraw-primitiveTopology-03420 ] Object 0: handle = 0x1e24f0d5bd8, type = VK_OBJECT_TYPE_COMMAND_BUFFER;
| MessageID = 0x673ecf55 | VkCommandBuffer 0x1e24f0d5bd8: Dynamic primitive topology state not set for this command buffer…
The Vulkan spec states: If the bound graphics pipeline state was created with the VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT dynamic state enabled then
vkCmdSetPrimitiveTopologyEXT must have been called in the current command buffer prior to this draw command, and the primitiveTopology parameter of
vkCmdSetPrimitiveTopologyEXT must be of the same topology class as the pipeline VkPipelineInputAssemblyStateCreateInfo::topology state
(https://vulkan.lunarg.com/doc/view/1.2.148.0/windows/1.2-extensions/vkspec.html#VUID-vkCmdDraw-primitiveTopology-03420)

This is correct, because I did set in dynamic states the VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT.

I really cannot understand what’s wrong in loading the extension command.
I had also thought that maybe the loader cannot find the valid address by the instance, so I tried to get it directly from the device:
vkCmdSetPrimitiveTopologyEXT = reinterpret_cast<PFN_vkCmdSetPrimitiveTopologyEXT>(vkGetDeviceProcAddr(device, “vkCmdSetPrimitiveTopologyEXT”));
where VkDevice is the logical device I’ve created for my physical device.
But that’s even worse, because that call returns a NULL pointer.

I’m a bit lost now, any help is greatly appreciated.
Btw, sorry if mine looks like a silly question. My problem is that I come from OpenGL, where things are much less complicated than Vulkan.

Thanks,
Gianluca

Never mind, I solved my issue!
In the creation of the logical device to handle the physical device, I had forgotten to enable the extension
“VK_EXT_extended_dynamic_state” in the VkDeviceCreateInfo, although I had added in pNext
a pointer to VkPhysicalDeviceExtendedDynamicStateFeaturesEXT.
Once enabled the extension for dynamic state changes, I can load and execute successfully
the “vkCmdSetPrimitiveTopologyEXT”.
Sorry for false alarm!