A CHARACTER or LONGCHAR variable passed as an OUTPUT parameter to a DLL cannot be the Unknown value or be uninitialized. (12450) - Forum - OpenEdge Development - Progress Community

A CHARACTER or LONGCHAR variable passed as an OUTPUT parameter to a DLL cannot be the Unknown value or be uninitialized. (12450)

 Forum

A CHARACTER or LONGCHAR variable passed as an OUTPUT parameter to a DLL cannot be the Unknown value or be uninitialized. (12450)

This question is answered

I have the above error when I try using below dll call.

DEFINE VARIABLE ServerInfo AS LONGCHAR NO-UNDO.
DEFINE VARIABLE RequestInfo AS LONGCHAR NO-UNDO.
DEFINE VARIABLE ResponseInfo AS LONGCHAR NO-UNDO.

RUN Test1(ServerInfo, RequestInfo, OUTPUT ResponseInfo).

PROCEDURE Test1 EXTERNAL 'Test.dll':
DEFINE INPUT PARAMETER serverInfoJson AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER messageJson AS CHARACTER NO-UNDO.
DEFINE RETURN PARAMETER ResponseMessage AS CHARACTER NO-UNDO.
END PROCEDURE.

What is the problem?

Verified Answer
  • This is a C# dll and is not handling call made as a standard dll.

    We are now using it as a .Net assembly.

All Replies
  • The message clearly says that OUTPUT parameter should be initialized. Help text with message number 12450:

    It is not really appropriate at all to pass a CHARACTER or LONGCHAR variable to a DLL as an OUTPUT parameter.  However, if you do, you must first store a character string in the variable that is at least as long as the expected output.  If you do not do this, it is likely that you will get a memory violation or other unexpected behavior.

  • Thank you Dileep,

    Output from the dll is going to be a json file as a 'string'. Is there anything I can do in this case?

    //public static string Test1(string serverInfoJson, string messageJson)

    It accepts 2 jsons, processes them and produces an output json.

  • Frankly, I think this is a bug.  This is not really an OUTPUT parameter.  It is the return value, as the DLL prototype shows.  We just use the OUTPUT parameter syntax to accomplish this.  So there should not be a problem with it.  But given that you are getting the error, just do what it says - store some small value into your ResponseInfo variable before making the call.  It doesn't matter what you put there.  It will get reset when you make the call.

  • I tried that but there is a run-time error and the session is closed with below protrace.

    Exception code: E0434352

    Fault address:  74AC08B2 01:000FF8B2 C:\Windows\System32\KERNELBASE.dll

    Registers:

    EAX:00AFE258

    EBX:00000005

    ECX:00000005

    EDX:00000000

    ESI:00AFE31C

    EDI:00000001

    CS:EIP:0023:74AC08B2

    SS:ESP:002B:00AFE258  EBP:00AFE2B4

    DS:002B  ES:002B  FS:0053  GS:002B

    Flags:00000212

    Debugging dll: C:\Progress\OpenEdge\bin\dbghelp.dll

    Symbol Path:

    C:\Progress\OpenEdge\bin;C:\Progress\OpenEdge\pdbfiles

    Call Stack:

    Address   Frame

    74AC08B2  00AFE2B4  RaiseException+62

    731280E2  00AFE350  GetPrivateContextsPerfCounters+10902

    73255F8B  00AFE380  CreateHistoryReader+1C5DB

    7326B7CC  00AFE414  CreateHistoryReader+31E1C

    705B1F0C  00AFE42C  0001:00000F0C C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll

    705B1F3A  00AFEB64  0001:00000F3A C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll

    705B2A2C  00AFEBE4  0001:00001A2C C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll

    705B2C21  00AFEBFC  0001:00001C21 C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll

    705B3612  00AFEC1C  0001:00002612 C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll

    705B3A63  00AFEC5C  0001:00002A63 C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll

    705B3BC1  00AFECD4  0001:00002BC1 C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll

    705B3D12  00AFEDD0  0001:00002D12 C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll

    705BD23D  00AFEE1C  0001:0000C23D C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll

    72FA7F2C  00AFEE78  CoUninitializeEE+8AEC

    72FA7FDD  00AFEEC0  CoUninitializeEE+8B9D

    72FA802E  00AFEF2C  CoUninitializeEE+8BEE

    72FA82C9  00AFF2F4  CoUninitializeEE+8E89

    72FA8586  00AFF3E8  CoUninitializeEE+9146

    72FAA8CF  00AFF468  CoUninitializeEE+B48F

    72F9C715  00AFF4E4  LogHelp_TerminateOnAssert+B135

    72F8EF99  00AFF514  0001:0000DF99 C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll

    7372D6E0  00AFF56C  CorDllMainWorkerForThunk+C0

    518B1324  00AFF5C0  dbut_utfIsLink+81074

    77E216B7  00AFF610  RtlAllocateHeap+307

    77E213EE  00AFF614  RtlAllocateHeap+3E

    77E1D7A3  00AFF620  RtlUnlockHeap+143

    77E1D7A3  00AFF62C  RtlUnlockHeap+143

    77E1D7E7  00AFF63C  RtlUnlockHeap+187

    77D64F84  00AFF684  GlobalLock+D4

    51608601  00AFF690  update_srvrLoggingLevel+3FF71

    518BC94C  00AFF694  dbut_utfIsLink+8C69C

    518BC96F  00AFF6AC  dbut_utfIsLink+8C6BF

    518BCA64  00AFF6E0  dbut_utfIsLink+8C7B4

    518C3D20  00AFF70C  dbut_utfIsLink+93A70

    518DF6C1  00AFF750  dbut_utfIsLink+AF411

    Is this an error from within the dll, meaning I made a successful connection?

  • That trace is no good.  You need to have the .pdb files in place (in DLC/bin)

  • This is a C# dll and is not handling call made as a standard dll.

    We are now using it as a .Net assembly.

  • This response came across my email, but I don't see it here:

       >This is a C# dll and is not handling call made as a standard dll.  We are now using it as a .Net assembly.

    Oh!  You can't call a .NET assembly from the ABL as if it were a C dll!  You can only use .NET objects from the ABL directly as objects.  What object does this method belong to?  You'd have to NEW the object to get an object reference, and then call its method. e.g.

      myObj = NEW <type-name>(<constructor parameters>).

      myObj:<method>(<parameters>).

    Or if the method is static, you call it using the "type-name syntax", e.g.:

      <type-name>:<method name>(<parameters>).