Closed ljzj2 closed 2 months ago
Additional static libraries are needed to successfully link. Refer to https://github.com/dotnet/samples/tree/main/core/nativeaot/NativeLibrary#building-static-libraries, specifically "You can find a list of additional framework libraries by publishing the project as shared library (/p:NativeLib=Shared) with detailed verbosity (-v d), and looking at the output generated by the LinkNative target.".
We do not recommend building static libraries, the developer experience is rough.
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas See info in area-owners.md if you want to be subscribed.
Ok as you say I will not do that.
Description
I created library in .net 8.0 and compile it to static lib(native aot): dotnet publish -r win-x64 -c release /p:NativeLib=Static and want to use it in c++ program but there is so errors.
Reproduction Steps
....... return Intptr.Zero; }
pragma comment(lib,"mylib.lib")
extern "C" get (const char* url);
int main(){ auto val=get("this is my href"); }
Expected behavior
will run perfectly
Actual behavior
lots of errors unresolved symbols RhYield RhWaitForPendingFinalizers RhUnregisterForGCReporting RhSuppressFinalize .... NCryptSetProperty NCryptOpenKey NCryptDeleteKey ...... g_cpuFeatures .... GlobalizationNative_ToUnicode GlobalizationNative_LastIndexOf GlobalizationNative_InitICUFunctions
....
as many as over 130 error
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response