How to resolve the algorithm Call a foreign-language function step by step in the PL/I programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Call a foreign-language function step by step in the PL/I programming language

Table of Contents

Problem Statement

Show how a foreign language function can be called from the language.

As an example, consider calling functions defined in the C language. Create a string containing "Hello World!" of the string type typical to the language. Pass the string content to C's strdup. The content can be copied if necessary. Get the result from strdup and print it using language means. Do not forget to free the result of strdup (allocated in the heap).

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Call a foreign-language function step by step in the PL/I programming language

Source code in the pl/i programming language

declare strdup entry (character (30) varyingz) options (fastcall16);

put (strdup('hello world') );


  

You may also check:How to resolve the algorithm Babbage problem step by step in the PL/I programming language
You may also check:How to resolve the algorithm Matrix transposition step by step in the PL/I programming language
You may also check:How to resolve the algorithm Read a specific line from a file step by step in the PL/I programming language
You may also check:How to resolve the algorithm Smith numbers step by step in the PL/I programming language
You may also check:How to resolve the algorithm Bitmap/Flood fill step by step in the PL/I programming language