Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 1559

Callback function in Visual COBOL .NET

$
0
0

Hello,

I´m trying to implement in Visual COBOL the following code (C#):

report.Render("Image", deviceInfo, CreateStream, out warnings);


CreateStream is not a dataitem but a function call... that is, a callback function defined previously as:

private Stream CreateStream(string name, string fileNameExtension, Encoding encoding, string mimeType, bool willSeek) { Stream stream = new MemoryStream(); m_streams.Add(stream); return stream; }

I can´t get the way to translate that type of callback function call as a parameter of a COBOL INVOKE.

This is what I tried, but although it compiles, it doesn´t run (null exception):

INVOKE informe::Render("Image", deviceInfo, CreateStream, warnings).

And this is the definition of my Callback function:

delegate-id CreateStreamHandler.
procedure division using nombre as string, fileExtension as string, codificacion as type Encoding, mimeType as string, willSeek as condition-value
RETURNING stream as type Stream.
end delegate.
 

01 CreateStream type CreateStreamCallBack.

method-id CreateStreamCallBack.
procedure division USING nombre as string, fileExtension as string, codificacion as type Encoding, mimeType as string, willSeek as condition-value
RETURNING stream as type Stream.
SET stream TO New MemoryStream().
INVOKE m_streams::Add(stream).
end method.

The code I´m trying to replicate is located here:

http://msdn.microsoft.com/es-es/library/ms252091.aspx

Kind regards


Viewing all articles
Browse latest Browse all 1559

Trending Articles



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