sudhamani
21st January 2004, 13:11
Hi All,
I am new to Baan tools. To my knowledge, one main difference between a DLL and a function is that incase of DLL less memory is occupied. i would greatly appreciate if anyone can give me other differences also.

zardoz
21st January 2004, 14:47
The function is simply a "piece of script" you include in your script. This means that if some changes are done in the function all the script using them are to be recomplied.
The DLL is a library, indipendent from other scrips. This means that if you change a DLL and recompile it, all the changes are immediatly in use.

mgakhar
21st January 2004, 18:02
hey sudhamani,
Just to add to Zardoz ...
Functions get attached to your Program Script at compile time. So the object created when you compile your program script contains the function also.

Whereas the DLL gets attached or invoked only at runtime.

MG.

sudhamani
22nd January 2004, 07:39
thanks MG and zardoz.
in that case why not always use a DLL instead of a function.
what is the advantage of using a function over a DLL ?

lbencic
22nd January 2004, 18:24
The vast majority of include functions are being converted to DLL's. The includes came first.

One instance that the includes are good for is in a case where there are several different includes that belong together, they have to be synched to the right version. If 1 piece gets updated on a system, the whole should not fail. If they were all libraries, if 1 piece is upgraded, the whole would (might) fail. In the case of includes, the script is compiled with matching includes, so no changes to the system after the fact would affect that. I believe that this is why it is taking so long to work out the report includes - I think they had to be synched to the porting set and/or tools version that it's compiled on.

windywine
26th January 2004, 23:01
There's one thing DLLs do not support: re-using macros and defines.

E.g. some Tools constants like EXTEND_APPEND and EXTEND_OVERWRITE can only be re-used by means of including files. In case of Tools this would be bic_global (which is automatically included in any 3gl script) and bic_interface (which is automatically included in any 4gl script).

Macros and defines cannot be re-used by means of DLLs. You can only re-use functions via DLLs.

windywine
26th January 2004, 23:13
The following construct can be very helpful when you have a DLL exposing some functions for which you want to define some constants.

Suppose you have created a DLL tccomdll0123 with the following rounding function:

function extern double tccom.dll0123.round.amount(
double amount, long mode)

Then you may want to define 3 possible values for the mode:
ROUND.UP, ROUND.DOWN, ARITHMETIC

These can only be defined in an include file (e.g. itccom0123). Now you can use the following construct in the include file:

#ifndef _tccomdll0123_
#pragma used dll otccomdll0123
#endif

#define ROUND.UP 1
#define ROUND.DOWN 2
#define ARITHMETIC 3

And in the tccomdll0123 DLL you do the following:

#define _tccomdll0123_
#include "itccom0123"

In this way the constants ROUND.UP etc. are known in the DLL itself.

Now any other component that wants to use the rounding function only needs to include the include file:

#include "itccom0123"