Giter Club home page Giter Club logo

Comments (4)

Perksey avatar Perksey commented on June 4, 2024

It would appear that this is a bug, this should be a context extension.

from silk.net.

okaniku avatar okaniku commented on June 4, 2024

Unfortunately it's still not working, even after changing it to a context extension.

Strangely, I'm able to successfully call the underlying function by doing this:

using var alc = ALContext.GetApi(true);
var deviceName = string.Empty;
var dev = alc.OpenDevice(deviceName);
var ctx = alc.CreateContext(dev, null);
alc.MakeContextCurrent(ctx);

if (dev != null && alc.TryGetExtension(dev, out ReopenDevices ext))
{
    var maxName = SilkMarshal.GetMaxSizeOf(deviceName, NativeStringEncoding.UTF8);
    var nameNative = deviceName.Length > 256 ? new byte[maxName] : stackalloc byte[maxName];
    fixed (byte* namePtr = nameNative)
    {
        ((delegate* unmanaged[Cdecl]<Device*, byte*, int*, bool>) alc.GetProcAddress(dev, "alcReopenDeviceSOFT"))(dev, namePtr, null);
    }
}

from silk.net.

Perksey avatar Perksey commented on June 4, 2024

@okaniku Can you compare the results of alc.Context.GetProcAddress("alcReopenDeviceSOFT") vs alc.GetProcAddress("alcReopenDeviceSOFT")

Relevant code:

https://github.com/dotnet/Silk.NET/blob/main/src/OpenAL/Silk.NET.OpenAL/ALC/ALContext.cs#L98

from silk.net.

okaniku avatar okaniku commented on June 4, 2024

Calling alc.Context.GetProcAddress() throws the same error. NativeLibrary3.TryGetExport() returns false, stack trace:

Silk.NET.Core.Loader.LibraryLoader.NetNextNativeLibraryLoader.CoreLoadFunctionPointer(nint handle, string functionName)
Silk.NET.Core.Loader.LibraryLoader.LoadFunctionPointer(nint handle, string functionName)
Silk.NET.Core.Loader.UnmanagedLibrary.LoadFunction(string name)
Silk.NET.Core.Contexts.DefaultNativeContext.GetProcAddress(string proc, int? slot)
Silk.NET.Core.Contexts.MultiNativeContext.GetProcAddress(string proc, int? slot)

from silk.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.