Skip to content

AccessViolationException when trying to run Vulkan function in FSharp. #48

Answered by deanjl
deanjl asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks heaps! I thought it would accept null for the count as well and that was a very bad assumption on my part.

However, the underlying issue is that when I tried passing a pointer to an actual count variable, I couldn't figure out how to convert it to the type that FSharp requires. Perhaps this is because the binding is more geared toward CSharp specifically rather than .Net generally?

So to answer the question fully for FSharp users, the required code is this:

open FSharp.NativeInterop
open Vortice.Vulkan
open type Vortice.Vulkan.Vulkan
...
let result = vkInitialize ()
...
let mutable propertyCount = 0u
let result = vkEnumerateInstanceExtensionProperties (Interop.AsPointer &propertyCo…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@amerkoleci
Comment options

@deanjl
Comment options

Answer selected by deanjl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants