Angelika_N
30th October 2008, 10:41
I want to use two DLL in one script. In both DLL there are variables with identical names (extern), for example 'r.mess'.
I receive a mistake at loading of the second DLL:
Error: Load DLL: Incompatible array subscripts in link external 'r.mess'
Error: Load DLL: Subscripts 1, source 150, external 100
Fatal error: Dynamic Link failure external symbol 'r.mess' in DLL object 'odll_1'
Fatal error: Can not continue in script_1 (function_1)

Is it possible to use these DLL together?

george7a
30th October 2008, 10:43
Hi,

You might want to check the Function overloading (http://www.baanboard.com/programmers_manual_baanerp_help_dynamic_link_libraries_function_overloading). Here are the available functions:
http://www.baanboard.com/programmers_manual_baanerp_help_functions_dll_overview_and_synopsis

- George

Angelika_N
30th October 2008, 12:49
I already use these functions for dynamic loading DLL (load_dll, get_function, exec_function).
I load the first DLL and I start its function.
Then I load the second library and I receive a error (global variables have identical names in different DLL)
It is possible to unload the first library?

george7a
30th October 2008, 13:50
I am not sure! I will check it...

try this workaround create a script, that uses the other DLL and call the function, then exports the wanted value. In your original script, import it.

- George

Angelika_N
30th October 2008, 14:45
I tried to create intermediate script and DLL.
It is impossible.

george7a
30th October 2008, 14:59
What are the DLLs that you are using? I would like to test it here.

Angelika_N
30th October 2008, 15:46
It not standard libraries.
In the first DLL there is a variable r.mess (it is declared as global, extern)
In the second DLL there is a same variable.

I run function get.item () the first DLL.
Then I run function get.clot () the second DLL.
The variable r.mess is not used anywhere

ARijke
31st October 2008, 10:03
The external variables should be unique. So one of those has to be renamed.

günther
5th November 2008, 11:58
Normally, the best coding style is to use unique names for external variables and functions (simply by using the dll name as prefix). This could also be done by using the preprocessor if you had to replace the entire dll code just because of renaming a variable.
And folks: Don't change anything of the interface of a dll; add new features - otherwise you will get errors on your live system! So, If you have to change too much, copy the dll and use the new one until you are sure that no other session depends on the old variables / functions!

In your case, I would suggest to check which dll has r.mess with 100 chars, and then to extend it to 150 chars. Then the problem should be solved (for the moment).

Günther