Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nativeaot can not create static lib that c++ can use? #6968

Closed
ljzj2 opened this issue Jun 20, 2024 · 0 comments
Closed

nativeaot can not create static lib that c++ can use? #6968

ljzj2 opened this issue Jun 20, 2024 · 0 comments

Comments

@ljzj2
Copy link

ljzj2 commented Jun 20, 2024

I want to use .net to create library then release it as Static lib(.lib). and another c++ program can use it.
I use this:
> dotnet publish /p:NativeLib=Static --use-current-runtime
int this page https://github.com/dotnet/samples/blob/main/core/nativeaot/NativeLibrary/README.md
but it seems not work.

there is one method:

[UnmanagedCallersOnly(EntryPoint = "get")]
public static IntPtr Get(IntPtr url)
{
return IntPtr.Zero
}

yes it will create mylib.lib but nothing in it.

If I use it in c++ program there will be unresolved symbols which means there is no this method in the lib right?

I have used this in c++
#pragma comment(lib,"mylib.lib");

@ljzj2 ljzj2 closed this as completed Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant