Core Function UnsetDLLStruct

From Sputnik Wiki
Jump to: navigation, search
UnsetDLLStruct( <dllstruct-name> )

Contents

Description

Delete a previous user defined DLLStruct from Sputnik.

dllstruct-name

The dllstruct name to delete.

Return Value

Success: Returns 1.

Failure: Returns 0.

Remarks

This function is used to remove a previous added dllstruct to Sputnik for example if you have a plugin system that adds a series of dllstructs you could make the plugin remove all dllstructs when a command is typed.

Then you could load the plugin again basically allowing an update to your programs source code while it is still running.

However anything that uses the dllstruct will be very unhappy to see its disappeared and they will cause a crash so its best to make sure nothing is using it before killing it.

Example

// Define a DLLStruct called myDLLStruct
DLLStructCreateDef("myDLLStruct", "int x;int y");
 
// Try make use of the dllstruct
$Struct = DLLStructCreate("myDLLStruct");
println("First completed");
 
// Now delete the dllstruct from Sputnik
UnsetDLLStruct("myDLLStruct");
 
// Try make use of the dllstruct AGAIN
// It should crash now since the dllstruct no longer exists
$Struct = DLLStructCreate("myDLLStruct");
println("Second completed");
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox