cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
josna_lobo
Level 2

Calling a .net function in install script

I am trying to invoke a function contained in a .net dll from install script.

I have a simple function in the .net class library as below

public void DisplayMessage(string message)
{
MessageBox.Show(message);
}

This class is set to ComVisible = true and on compiling results in TestLibrary.dll

In install script,

I have created a prototype for the function as below. This is the first line after the header declarations.

prototype void TestLibrary.DisplayMessage(STRING)


I am loading the dll, as below

UseDLL(dllPath)
// where dllPath refers to the path where dll resides in the install shield project. The dll has been added to the Support files under Behavior and Logic section.

The dll loads perfectly fine, which I have confirmed using the return parameter from the UseDLL function.

But when i do the below to invoke the function, the script throws an error.

TestLibrary.DisplayMessage(sValue); //sValue is set to appropriate text in the code.

Can anyone tell me what I might be doing wrongly.

I have tried by making the class static.
Labels (1)
0 Kudos
(1) Reply
RobertDickau
Flexera Alumni

UseDLL and UnUseDLL are intended for C-callable DLLs; please see the help and links on the "DotNetCoCreateObject" topic for information about calling .NET methods from InstallScript.
0 Kudos