while you can compile a library to AOT. There are restrictions on what code the library executes, limited reflection, etc. also the library is a native library, and will not have managed code entry points. you would use pinvoke to call methods in the library just like any native library.
https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=net7%2Cwindows
note: typically you use would an obfuscator for your needs. google for the best options.