Problem:
01 pp procedure-pointer.
...
set pp to entry "prog2"
if pp not = null
call "subprog"
else
display "load error"
end-if.
When executed from native code the set statement results in pp being set to the first ordinal in the .dll whether or not it has an entry point with the same name as the .dll.
They are converting the main program to managed code and when they execute the same code to load the native "prog2.dll", the .dll is loaded correctly but the value of pp remains null so the test of null fails. Why?
Resolution:
So if they actually had a program called "prog2" in the "prog2.dll" it would load the .dll and set pp to a non-null value.
Since the entry point name that they wish to call is different than the name of the .dll then in order to test if it loaded successfully they would have to do:
set pp to entry "prog2"
if pp = null
set pp to entry "subprog"
if pp = null
display " load error"
else
display "loaded"
call "subprog"
end-if
else
display "loaded"
call "subprog"
end-if.
Another option is to add a dummy COBOL program that had the same name as the .dll to the .dll.
identification division.
program-id. prog2.
procedure division.
goback.
Then when the statement:
set pp to entry "prog2"
is executed it will call the dummy program and pp will be set to non-null so it will pass the not null test.
#Enterprise
#EnterpriseDeveloper
#COBOL
#VisualCOBOL



