Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to call VC++ dll whiich return char[] data type value in powerbuilder

Hi Everyone,

I am using PowerBuilder 11.1 build 8123.

I am calling VC++ DLL in our PowerBuilder application which return char[] data type value.

I just declare Global External Function:-

     Function  char getOSSectionName() library "DocServClient.dll" alias for "getOSSectionName;Ansi"

And then call this function in window as:-

     Char      ls_section[1] = 'DOCAPPLICATIONS9X'

     ls_section[1]=getOSSectionName()

When I check ls_section[1] value in messagebox it display a symbol (please check attached attached image.)

VC++ function and return variable declaration:-

     __declspec(dllexport) char *  __stdcall getOSSectionName()

      {

       char    SectionName[_MAX_PATH];

Please let me know that my code is valid or not.

Please help..

error.png (8476 B)
Former Member
Former Member replied

Hi,

Thanks to Everyone for your suggestions.

I am solved my problem to change VC++ function as :-

     Int __declspec(dllexport)  __stdcall getOSSectionName(char* SectionName)

                    instead of

     __declspec(dllexport) char *  __stdcall getOSSectionName()

and declare global function as:-

       Function int getOSSectionName(Ref char ls_section[100]) library "DocServClient.dll" alias for "getOSSectionName;Ansi"

and call function in window as:-

     int li_ret

     char ls_section[100]

     string ls_sec

     li_ret=getOSSectionName(REF ls_section)

     ls_sec=ls_section

Thanks,

Vikrant

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question