See also Unload Option in the NXOpen Programmer's Guide for additional details and to explain that unloading an image is nothing that needs to be done actively.
It happens automatically if NX finds and calls this method with the appropriate return value.
The Visual Studio NXOpen wizards also add this method to the template code.
Hi @AmolKadam ,
It is not working. I shall explain a bit more.
I have created one .dll file to find number of curves in a model file. Once after I run .dll file in the model file and after if I try to do modifications in the code in visual studio and trying to re-build .dll file getting an error.
If I navigate to,
File --> Utilities --> Unload Shared Image
and click on Unload All.
After that if I go to visual studio and re-build it is successfull.
Hope you got me. Let me know if you have any clarifications.
In your original program include a fuction
Public Shared Function GetUnloadOption(ByVal arg As String) As Integer 'Return CType(Session.LibraryUnloadOption.Explicitly, Integer) Return CType(Session.LibraryUnloadOption.Immediately, Integer) ' Return CType(Session.LibraryUnloadOption.AtTermination, Integer) End Function
and rebuild it.
Note there are certain things in API that, if you have them in your code, prevent the API program from being unloaded.
I believe there is documentation somewhere, but things like registering a callback typically cause this issue.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled
> You have to put this function where your static "Main" method is
The GetUnloadOption function has to be in the same assembly (DLL or EXE) as your Main function. Some people say that these two functions need to be in the same class, but this is not true.
You could (temporarily) comment out all the code in your Main function, and see if unloading then works correctly. If it does, then something in your Main function is blocking unloading, as KenA suggested.
If you post your code, you have a much better chance of getting a good answer.