chavez
27th March 2013, 12:40
Hello,
Recently I noticed that in some functions from session scripts the word "extern" appears in the declaration.
Does this mean that it can be called like a dll function from another library/script.
If this is true how can it be declared for use.
Thank you
Chavez
zardoz
27th March 2013, 12:56
It's not correct.
The functions declared extern are used in LN instead of the user.options.
By example, you can make in a script like:
function extern something.to.do()
{
......
}
and declare in the session this function (something.to.do) to be used as an option called by the user. I dont think this function could be called from another dll/script.
benito
27th March 2013, 13:06
i haven't tried it but looks like it might work. you need to declare, for example,
#pragma used dll otccom4410
the only downside to this is your dlls/functions would be hard to find later so i would still prefer to have a dll with the correct descriptions of the functionality.
benito
27th March 2013, 13:18
i just tried and it did work. still...i don't like using it like this.
BaanInOhio
27th March 2013, 18:03
You can execute standard extern functions from sessions using exec_dll_function. In this example, I can run a standard function (start.fu.workorder.tree) that is defined as a form command in a standard session (tswcs2100m100) from a custom session.
ret = exec_dll_function("otswcs2100", "start.fu.workorder.tree")
Optional arguments after these two are for the return value of the function when present (3rd) and more optional arguments for passing variables to the function. You can determine returned values and arguments using "ttstpobinfo" or "ttadv2439m000".
chavez
27th March 2013, 20:27
Thank you All,
I know it's not a neat thing to do but it saved me a lot of work in rewriting and maintaining the code.