www.buildautomator.com  Build Automator Documentation

Call DLL

Previous  Top  Next  


The Call DLL action is a very powerful extension to the Build Automator.  You can call any function in any dll as long as it follows certain rules about parameters and return values.

 

The functions being called with this function must be prototyped with CONST *CSTRING parameters in Clarion or char* parameters in C.  The function can take no parameter or it can take anywhere from 1 to 6 parameters.  The function must return an integer value.  In Clarion it must be declared with the PASCAL attribute and in C it must be declared with the __stdcall atribute.

 

Please note that if the number of parameters as entered into the window, see below, is not correct the action will GPF immediately when it is called to execute.  We suggest that you make sure that your project file is saved before you execute this function!

 

 

Call_DLL_1_Proc

 

 

Properties

Explanation

DLL File  ROMx116_dblisttable

Select the DLL file to call.  The DLL does not to be in the search path and the Build Automator will load the DLL from the path that is specified here without attempting to locate it on the path first.

Function to call

Select the function that you want to call from the dropdown.  The entries in the dropdown are reset every time you select a new DLL to call. 

Number of Parameters

The number of *CSTRING/char* parameters that the function accepts.  Make sure that this matches the prototype of the function you selected in the "Function to call" drop down list.

Parameters  ROMx116_dblisttable

Enter the appropriate parameters to pass to the function.  Normal strings can be typed in without single or double quotes, for example in the screenshot above the first parameter will be passed as 'First Paramter'  You can use string literals or you can use variables or a mix of both, for example:
 
Today is $ToDay$ and the time is $Now$  

 

Below is a very simple DLL example compiled in Clarion 6.3. 

 

TestDLL.CLW

 Program

 Map

Test1                  FUNCTION(CONST *CString pP1),Long,PASCAL,Name('Test1')

Test2                  FUNCTION(CONST *CString pP1, |

                                CONST *CString pP2),Long,PASCAL,Name('Test2')

Test3                  FUNCTION(CONST *CString pP1, |

                                CONST *CString pP2, |

                                CONST *CString pP3),Long,PASCAL,Name('Test3')

Test4                  FUNCTION(CONST *CString pP1, |

                                CONST *CString pP2, |

                                CONST *CString pP3, |

                                CONST *CString pP4),Long,PASCAL,Name('Test4')

Test5                  FUNCTION(CONST *CString pP1, |

                                CONST *CString pP2, |

                                CONST *CString pP3, |

                                CONST *CString pP4, |

                                CONST *CString pP5),Long,PASCAL,Name('Test5')

Test6                  FUNCTION(CONST *CString pP1, |

                                CONST *CString pP2, |

                                CONST *CString pP3, |

                                CONST *CString pP4, |

                                CONST *CString pP5, |

                                CONST *CString pP6),Long,PASCAL,Name('Test6')

 End

 

 Code

 

 

Test1                PROCEDURE  (CONST *CString pP1)!!,Long,PASCAL,Name('Test1')

 Code

 Message('1:  ' & pP1,'Test with 1 parameter',ICON:Exclamation)

 Return(1)

 

Test2                  FUNCTION(CONST *CString pP1, CONST *CString pP2)!!,Long,PASCAL,Name('Test1')

 Code

 Message('1:  ' & pP1 & '|2:  ' & pP2,'Test with 2 parameters',ICON:Exclamation)

 Return(2)

 

Test3                  FUNCTION(CONST *CString pP1, CONST *CString pP2, CONST *CString pP3)!!,Long,PASCAL,Name('Test1')

 Code

 Message('1:  ' & pP1 & '|2:  ' & pP2 & '|3:  ' & pP3,'Test with 3 parameters',ICON:Exclamation)

 Return(3)

 

Test4                  FUNCTION(CONST *CString pP1, CONST *CString pP2, CONST *CString pP3, CONST *CString pP4)!!,Long,PASCAL,Name('Test1')

 Code

 Message('1:  ' & pP1 & '|2:  ' & pP2 & '|3:  ' & pP3 & '|4:  ' & pP4,'Test with 4 parameters',ICON:Exclamation)

 Return(4)

 

Test5                  FUNCTION(CONST *CString pP1, CONST *CString pP2, CONST *CString pP3, CONST *CString pP4, CONST *CString pP5)!!,Long,PASCAL,Name('Test1')

 Code

 Message('1:  ' & pP1 & '|2:  ' & pP2 & '|3:  ' & pP3 & '|4:  ' & pP4 & '|5:  ' & pP5,'Test with 5 parameters',ICON:Exclamation)

 Return(5)

 

Test6                  FUNCTION(CONST *CString pP1, CONST *CString pP2, CONST *CString pP3, CONST *CString pP4, CONST *CString pP5, CONST *CString pP6)!!,Long,PASCAL,Name('Test1')

 Code

 Message('1:  ' & pP1 & '|2:  ' & pP2 & '|3:  ' & pP3 & '|4:  ' & pP4 & '|5:  ' & pP5 & '|6:  ' & pP6,'Test with 6 parameters',ICON:Exclamation)

 Return(6)

 

 

TestDLL.PRJ

 

-- Test DLL

#noedit

#system win32

#model clarion dll

#pragma define(maincode=>off)

#set RELEASE = on

#pragma debug(vid=>off)

#pragma optimize(cpu=>386)

#compile "TestDLL.clw"

#link "TestDLL.dll"

 



Direct link to this page: http://www.buildautomator.com/onlinemanual/call_dll.htm