I'm following the tutorial to call unmanaged COBOL code from managed COBOL, but I get this exception: "System.AccessViolationException".
What is causing it?
"call "prog2" using custRecord"
I found the tutorial here: community.microfocus.com/.../visual-cobol-for-visual-studio-getting-started-with-solutions-projects-and-the-cobol-call-statement-pinvoke
I'm using VS2015 and VC3.0, but I don't need this feature anymore.
Now all projects are Managed Cobol and calls work perfecly except when I try to call a program using a variable.
E.g. if I try this:
01 toBeCalled PIC X(8).
move 'TABEL010' to toBeCalled
I get error 173 (program not found), instead doing:
the program is called correctly.
THank you for your help!
What is the name of the assembly in which TABEL010 is contained? If the assembly name is different than the program name being called and you are calling it dynamically then you first need to load the assembly in order to make it's entry points visible.
This is done automatically when you use a static call (call 'TABEL010') because the compiler can resolve the program name to a referenced assembly at compile time. It cannot do this if you are calling dynamically using a data name.
There are several ways to load the assembly and I believe that a few of these are covered in the tutorial you are using.
You can add a call statement to call the name of the assembly (.dll). The default name is the project name but this can be changed. So of your project name containing TABEL010 is called 'project2' then you could do:
You can also set a procedure-pointer to the assembly name:
01 pp procedure-pointer.
set pp to entry 'project2'
You can also create an app.config file and place the names of the .dlls that need to be loaded into the preload section as documented here: