Hello Team,
We have a problem with one function - Repaint(), which we were able to use without issues in PB 9.03, but now - after migrating the application to the new version PB 2019 R3 using the migration tool - the function execution thows errors.
It is most probably caused by types mismatch, but we cannot figure it out.
Is there now, in the new version, some background type conversion happening?
1. We have a C dll generated in 2010.
Unfortunately we don't have source code.
2. The Repaint() function declared in Local External Function
FUNCTION long Repaint (ulong handle, long swidth, long sheight, s_node a[], s_edge b[], s_edge_dod c[], int op1, int op23, int plpk, int pls, int dl) LIBRARY "graf.dll"
or
FUNCTION long Repaint (ulong handle, long swidth, long sheight, s_node a[], s_edge b[], s_edge_dod c[], int op1, int op23, int plpk, int pls, int dl) LIBRARY "graf.dll" alias for "Repainr;ansi"
or
FUNCTION long Repaint (ulong handle, long swidth, long sheight, ref s_node a[], ref s_edge b[], ref s_edge_dod c[], int op1, int op23, int plpk, int pls, int dl) LIBRARY "graf.dll" alias for "Repainr;ansi"
has been called with the code in a user event as below
Repaint (Handle(this), ll_width, ll_height, istr_node, istr_edge, istr_edge_dod, gl_node, gl_farend, gl_ports, gl_lines, displaylines)
or
Repaint (Handle(this), ll_width, ll_height, istr_node[], istr_edge[], istr_edge_dod[], gl_node, gl_farend, gl_ports, gl_lines, displaylines)
where for example
s_node istr_node[]
and
global type s_node from structure
long id
long x
long y
long typ
character descr1[255]
character descr2[255]
character descr3[255]
long display
long width
long height
long bitmapsize
long status
Other structures
s_edge istr_edge[]
s_edge_dod istr_edge_dod[]
have similar definitions.
The error message we get is:
"Error calling external function %s"
We tried using string as datatype in input instead of character, but then the error message is:
"specified argument type differs from required argument type at run time in DLL function Repaint - invalid stack pointer on return from function call at line ....)
3. As mentioned this dll and its functions are used in PB 9.03 application and works witout issues.
Sample screen:
4. Searched in google and Appeon community - we tried different approaches but could not find the solution for this specific problem.
We use Appeon PB 2019 R3.
Can we find in PB tools to implement this functionality - show the network schema with nodes and edges (connection between them)?
Any support from you will be much appreciated.
Kind regards, ZFW
If I may add a point of clarification for others that read this thread: The inclusion of the "progma_pack(1)" option on an external function declaration is NOT required when interfacing with all DLL's written in C - Zbigniew needed to use this option because the DLL his app interfaces with was created many years ago before packing on 8-byte boundaries became the standard. He did not have the DLL source code to be able to update/recompile it to utilize 8-byte packing.