Quantcast
Channel: Baanboard.com
Viewing all articles
Browse latest Browse all 4216

Use DLL function call from external variable

$
0
0
This is a somewhat out-of-the-box question.

Usually in a program script you can call functions in a DLL by just typing their name: tccomdllo0001.do.check.this.bp(tccom001.bpid)

What I want to try is this:
In a fixed program (once compiled) I want to be able to extend its functionality and call newer DLL functions without touching the caller program.

I think it is impossible, since you need this "function call" in the object "used functions". On the other hand, is the PCF not more or less doing the same?

So I want to put the name of the function to be called from a (set of) DLLs
(which are declared = #pragma used dll "ofunction_library") in a variable.
Like in
Code:

if pos(filename, VAR_FILETYPE_1) <> 0 and
    tccomdll.&FUNCTION_FILETYPE_1(FUNC_ARG_LIST_1) then
        mess("tcgenstring", 1, "File " & filename & " passed test " & FUNCTION_FILETYPE_1)

In this way you can call any pre-programmed function for any file-type depending on the content of the program string variables VAR_FILETYPE_1, FUNCTION_FILETYPE_1 and FUNC_ARG_LIST_1.

It is a bit similar to what you can do with program variables
Code:

  if put.var(pid, trim$(tolower$(tccom905.pvid)), trim$(
                                tccom905.data)) =1 then
        message("Program Variable " & quoted.string(
                                trim$(tolower$(tccom905.pvid))) &
                                " set to value " & trim$(tccom905.data) & ".")
  endif

It is a bit similar to
Code:

var_1 = trim$(tccom905.data)
except that also the name of the variable is variable... to a certain extend (as is its datatype due to implicit conversion).

The named program variable in tccom905.pvid must be pre-known in the program script and declared extern, but its value and its name can be set in a parameterized table tccom905.

Your first question would be: why would you want this?
hmmm you made me thinking like :confused:

It is easy to do the something similar with:
Code:

if pos(filename, VAR_FILENAME_1) <> 0 and    tccomdllo0001.do.check.1(FUNC_ARG_LIST_1) then

Viewing all articles
Browse latest Browse all 4216

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>