Problem with using external functions of a DLL in C

Discussion forum about all things Team Developer 5.x and 6.x
wsamstag
Germany
Posts: 7
Joined: 13 Apr 2017, 09:41
Location: Munich, Germany

Problem with using external functions of a DLL in C

Post by wsamstag » 16 Dec 2020, 15:43

Hi community,

I have a problem with using an external functions (DLL was written in C).

Here the documentation from the function:
14 SepaTools_CreateXML
14.1 Purpose of the function
This function initializes then XML export. The corresponding parameters in the structure are
passed.
14.2 Function call
int SepaTools_CreateXML( XMLCreateStruct *CreateStruct)
14.3 Parameter
CreateStruct Please pass a pointer to CreateStruct. The structure is shown below. All
strings are terminated with a binary NULL. The length of the char array is
therefore one byte longer as the actual text.

For all other strings it is checked internally if it is a valid character set for
SEPA payments. Is it not, the invalid characters are removed. The corrected
character string is returned in the structure.

Already this function checks whether in the specified path for the export file
(the file which has to be emitted), can be written.

struct XMLCreateStruct
{ char ExportPfad[255+1]
int Direct debit
char XMLName[35+1]
char MsgId[35+1]
char EinreicherName[70+1]
}
Here my function:

Code: Select all

Function: SepaTools_CreateXML
	Description: Mit dieser Funktion wird die Ausgabe von XML-Dateien initialisiert. Die entsprechenden Werte
			werden in der Struktur als Parameter übergeben.
			
			Return:		int
			
			Parameter:	struct XMLCreateStruct
					{	char	ExportPfad[255+1]	Laufwerk und Pfad für die Ausgabe der XML-Datei.
						int	Lastschrift		Überweisung (=0) oder Lastschrift (=1).
						char	XMLName[35+1]		Der Name der zu erzeugenden XML-Datei 1).
						char	MsgId[35+1]		Message-Id (Kennung) für die XML-Datei 2).
						char	EinreicherName[70+1]	Name des Einreichers der Datei (mind. 3 Zeichen).
					}
			
	Export Ordinal: 0
	Returns
		Number: INT
	Parameters
		structPointer
			String: LPSTR
			Number: INT
			String: char[36]
			String: char[36]
			String: char[71]
And here is the call to the function:

Code: Select all

Function: CreateSepaDatei
	Description:
	Returns
		Boolean:
	Parameters
		String: ps_ExportPfad
		String: ps_XMLName
		String: ps_MsgId
		String: ps_EinreicherName
	Static Variables
	Local variables
		Boolean: b_Ok
		Number: n_Returncode
	Actions
		Call SalSetBufferLength( ps_ExportPfad, 256 )
		Call SalSetBufferLength( ps_XMLName, 36 )
		Call SalSetBufferLength( ps_MsgId, 36 )
		Call SalSetBufferLength( ps_EinreicherName, 71 )
		!
		Set n_Returncode =  SepaTools_CreateXML( ps_ExportPfad, 0, ps_XMLName, ps_MsgId, ps_EinreicherName )
		If n_Returncode = 0
			Set b_Ok = TRUE
		Else If n_Returncode = 1
			Set is_HinweisText = GetErrorFromCreateXMLExt( 'CreateXMLExt', n_Returncode )
			Set b_Ok = TRUE
		Else
			Set is_ErrorText = GetErrorFromCreateXMLExt( 'CreateXMLExt', n_Returncode )
			Set b_Ok = FALSE
		!
		Return b_Ok
So, when I started I get the returncode -7. When I copy ps_ExportPfad into a LongString-Variable, I get the returncode -4.

Can anyone help me to solve the problem?

We use TD 6.2 SP5.

Regards,
Werner
You do not have the required permissions to view the files attached to this post.

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests