Rev1041 compiled well (see note above) even though I had yet to set "cob_get_global_ptr()->cob_call_params = 4" before calling the cobol program from C (WinMain->CobMain), to work without problems. Starting in rev.1044 onwards, I could't compile it no more. And the error is weird "cobc: aborting compile of CobMain.cbl at line 1".
NOTE (about rev.1041 and probably below):
I noticed this behavior recently:
When adding "-o ListView.exe", in the command prompt, I get this absurd error:
To fix the C compiler warning include <windows.h>. Leads to the following warnings but compiles:
WinMain.c(47): warning C4477: "printf": Die Formatzeichenfolge "%x" erfordert ein Argument vom Typ "unsigned int", das variadic-Argument "1" weist aber den Typ "HINSTANCE" auf.
WinMain.c(48): warning C4477: "printf": Die Formatzeichenfolge "%x" erfordert ein Argument vom Typ "unsigned int", das variadic-Argument "1" weist aber den Typ "HINSTANCE" auf.
WinMain.c(49): warning C4477: "printf": Die Formatzeichenfolge "%x" erfordert ein Argument vom Typ "unsigned int", das variadic-Argument "2" weist aber den Typ "LPSTR" auf.
return status: 0
Nonetheless I'm investigating the SIGSEGV now.
Last edit: Simon Sobisch 2016-10-12
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Initially, this example was made using "VC2010" and not "VC2015" (which you are using) or any other version. I'm testing now the remainig variants but also found "some" problems. "VC2010" sporadically (I'm testing the others too) seems not to like the name "CALL-CONVENTION" statement, hence (once in a while) when compiling, it showns something like "<program-name>.cbl (19): error: invalid system-name 'CALL-CONVENTIONY½!gìþ'" <- gibberish (memory corruption?) and a bunch of error related with WINAPI. VS2015, on the other hand does many complaints with code made for previous compilers. The example you gave to me showed that, when compiled with VS2010 there is "code" before variable declarations or was not compiled in C++ mode (instead of C mode only which is the default). I'm not sure (I had many of those). Nonetheless, I didn't see anything wrong(?). This is one more thing to check out. Nonetheless, I'm going to give you the "replication" of my example as soon as possible. They are somewhat "tricky" and have many dependencies (use one directory of your choice. When I'm ready, I'll give you a link to my "cloud" folder to download its content.
BTW: You only need to include "libcob.h" and "libcobx.h" when compiling (only) "WinMain.c", just like (I'll attach those):
SET INCLUDE=<directory_which_contains_libcob_h>;%INCLUDE
I've fixed the "memory corruption gibberish" with the same revision as the SIGSEGV.
... and if possible you should keep library headers clean (the informatin I've patched libcob.h was missing - and I see no problem in including libcobx.h in your WinMain.c).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, yes, you have a point there. I'll do that, but first I'll wait you to implement the INCLUDE .h files in cobol source. Anyways, "libcob.h" is only a starting point (and don't bother anyone, except you) and we are working in multiplatform (there's allways an IF). Sergey did that too with "mpir.h". (do you remember?). I'll remember you with the following attachement:
Cheers,
MM
PS: This goes for all of us, whether Tyrians or Trojans, although I am not sure whether there are any Tyrians and Trojans here.
I didn't found the feature-request about the include possibility. Can you please check/add a feature request for this? Are there other compilers directly allowing this? If not we could use an implementor defined preprocessor directive like >> IMP INCLUDE stuff.h.
My current thoughts were about adding a command line option but we may should do both (internally using the same function).
We likely should deactivate the C function prototype generation for static calls as soon as we find any C header (otherwise we'd likely produce multiple declarations).
And yes, I remember the mpir.h part in CPP version but have to say that MPIR team strictly advises to don't do so but to configure MPIR with gmp-compat instead (when it is used as GMP replacement). This is the reason I did not merged this part to the 2.0 line.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There never was a feature-request about this but there was an "idea" that came from you about the inclusion of a -H or a --headerinclude <file> (which Brian didn't like very much, for timing reasons) here:
Nonetheless the >>IMP INCLUDE stuff.h you refered seems to be even a better idea.
If you want, I'll create a ticket in the Wish-list".
But, most important now is the inclusion of "libcobx.h" (or its code) in "libcob.h". This is of the most importance when dealing with WINAPIs because if I don't, I'll receive a bunch of "unresolved externals" from the cobol objects (when linking all together).
MM@CROSSHAIR [D:\DEV\MM\test2\cobwin]
$ _make
loading standard configuration file 'default.conf'
command line: cobc -x -v -save-temps=temps -P -A -wd4047 -A -wd4024 -A -wd4133 winmain.c wincon.c
cobmain.cbl
executing: cl.exe /c /nologo -wd4047 -wd4024 -wd4133 /MD /Fo"winmain.obj"
"winmain.c"
winmain.c
return status: 0
executing: cl.exe /c /nologo -wd4047 -wd4024 -wd4133 /MD /Fo"wincon.obj"
"wincon.c"
wincon.c
return status: 0
preprocessing: cobmain.cbl -> cobmain.i
return status: 0
parsing: cobmain.i (cobmain.cbl)
return status: 0
translating: cobmain.i -> cobmain.c (cobmain.cbl)
executing: cl.exe /c /nologo -wd4047 -wd4024 -wd4133 /MD /Fo"cobmain.obj"
"cobmain.c"
cobmain.c
return status: 0
executing: cl.exe /MD /Fe"winmain.exe" "winmain.obj" "wincon.obj"
"cobmain.obj" /link /manifest /nologo gci.lib libcob.lib
libdb.lib mpir.lib pdcurses.lib USER32.LIB GDI32.LIB
WINSPOOL.LIB COMDLG32.LIB ADVAPI32.LIB SHELL32.LIB OLE32.LIB
OLEAUT32.LIB UUID.LIB ODBC32.LIB ODBCCP32.LIB USERENV.LIB
SECUR32.LIB WS2_32.LIB COMCTL32.LIB
Creating library winmain.lib and object winmain.exp
cobmain.obj : error LNK2019: unresolved external symbol _DispatchMessageA referenced in function _CobMain_
cobmain.obj : error LNK2019: unresolved external symbol _TranslateMessage referenced in function _CobMain_
cobmain.obj : error LNK2019: unresolved external symbol _GetMessageA referenced in function _CobMain
_
cobmain.obj : error LNK2019: unresolved external symbol _UpdateWindow referenced in function _CobMain_
cobmain.obj : error LNK2019: unresolved external symbol _ShowWindow referenced in function _CobMain_
cobmain.obj : error LNK2019: unresolved external symbol _CreateWindowExA referenced in function _CobMain_
cobmain.obj : error LNK2019: unresolved external symbol _RegisterClassA referenced in function _CobMain_
cobmain.obj : error LNK2019: unresolved external symbol _GetStockObject referenced in function _CobMain_
cobmain.obj : error LNK2019: unresolved external symbol _LoadCursorA referenced in function _CobMain_
cobmain.obj : error LNK2019: unresolved external symbol _LoadIconA referenced in function _CobMain_
cobmain.obj : error LNK2019: unresolved external symbol _FindWindowA referenced in function _CobMain_
cobmain.obj : error LNK2019: unresolved external symbol _DefWindowProcA referenced in function _CobWndProc_
cobmain.obj : error LNK2019: unresolved external symbol _PostQuitMessage referenced in function _CobWndProc_
cobmain.obj : error LNK2019: unresolved external symbol _EndPaint referenced in function _CobWndProc_
cobmain.obj : error LNK2019: unresolved external symbol _DrawTextA referenced in function _CobWndProc_
cobmain.obj : error LNK2019: unresolved external symbol _GetClientRect referenced in function _CobWndProc_
cobmain.obj : error LNK2019: unresolved external symbol _FillRect referenced in function _CobWndProc_
cobmain.obj : error LNK2019: unresolved external symbol _BeginPaint referenced in function _CobWndProc_
winmain.exe : fatal error LNK1120: 18 unresolved externals
return status: 2
See what I mean?
The APIs above are executed using CALL WINAPI "c_api_func" USING ... END-CALL so, #include <windows.h> must be included anywhere in "libcob.h" or anywhere when the C code is to be generated.
What the generated C code have is something like this:
/* Generated by cobc 2.0.1041 *//* Generated from cobmain.cbl *//* Generated at out 13 2016 15:44:08 *//* GnuCOBOL build date Aug 09 2016 21:06:56 *//* GnuCOBOL package date Oct 25 2015 21:40:28 UTC *//* Compile command cobc -x -v -save-temps=temps -P -A -wd4047 -A -wd4024 -A -wd4133 winmain.c wincon.c cobmain.cbl */#include<stdio.h>#include<stdlib.h>#include<stddef.h>#include<string.h>#include<math.h>#define COB_KEYWORD_INLINE __inline----------------------------------------------------------------------------------------------------------------------#include<libcob.h> /* Missing #include <windows.h> */----------------------------------------------------------------------------------------------------------------------#define COB_SOURCE_FILE "cobmain.cbl"#define COB_PACKAGE_VERSION "2.0"#define COB_PATCH_LEVEL 1041#define COB_MODULE_FORMATTED_DATE "out 13 2016 15:44:08"#define COB_MODULE_DATE 20161013#define COB_MODULE_TIME 154408/* Global variables */#include"cobmain.c.h"
Yes, please create the feature request (with a target for GC2.1) containing both the command line option for including it in the local header files and the preprocessor directive to do the same.
And please include the workaround (which I highly suggest you to use): force the inclusion of the header with the C compiler.
The option for GCC: --include stuff.h
The option for MSC: /FI stuff.h
You have three possibilities to do so:
1) before building: change defaults.h to include these in the COB_CFLAGS
only useful if you want to add these for every single program (this is similar to hacking libcbo.h - I wouldn't recommend both variants) and if you do so you likely want to hack COB_LDFLAGS, too and adding libraries there
2) temporary via environment: set the environment options (likely get the default first via cobc --info and only add/adjust) - influences all compilations you do in this shell afterwards
3) recommended: add this directly on the command line via cobc -A "/FI winlibs.h" ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Do you still have any issues with the latest svn revision? For example the -o issue?
Please add the workaround options for INCLUDE to the ticket, too. Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Used GnuCOBOL 2.0.1155 with all 3 tests with VS 2010-12-13-15 in both x86 and x64. Now, "libcob.h" is clean. I'll test further versions (in time). All I could see went well. I'll attach them all... The -o issue "is no more" for the time beeing. About the "ticket", I added one to the "Wish-list" if it's what you mean: https://sourceforge.net/p/open-cobol/feature-requests/176/
Am I missing something? Do you need more information I may have inadvertently omitted?
I've used your sample and run _make.cmd and had some adjustments to do:
got lots of COBOL errors which were resolved by adding -I copy to "cobol compiler main flags"
got CobMain.cbl (45): error: typedef/SIZE_T: No such file or directory resolved by hard-coding it to 4 for the following tests
this lead to an old bug (SIGSEGV again...) of rw-branch integrated to 2.0 branch recently with [r1132] and is fixed there now with [r1154]
got undefined references to lots of Windows API, solved by set COB_LIBS=libcob.lib USER32.LIB GDI32.LIB WINSPOOL.LIB COMDLG32.LIB ADVAPI32.LIB SHELL32.LIB OLE32.LIB OLEAUT32.LIB UUID.LIB ODBC32.LIB ODBCCP32.LIB USERENV.LIB SECUR32.LIB WS2_32.LIB COMCTL32.LIB (brute force, I would recommend to only use the ones needed)
got undefined references to LoadMenu@8 and _DialogBoxA@16, added -A "/FI libcobx.h" to __cobflags__
this lead to redefinition errors for the static calls which were resolved by a new compiler flag to disable it (added with [r1155]) and adding the new -fno-gen-c-decl-static-call to __cobflags__, got a WinMain.exe
just for curiosity: activated "Add output exe name (This will give an obscure error when compiling)", got ListView.exe, no obscure error
run ListView.exe, seems to work
Are there any more issues you see with the current svn version when using an unpatched libcob and the flags -A "/FI libcobx.h" -fno-gen-c-decl-static-call?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would first like to show my appreciation for the effort you applied in this peculiar matter.
Note that I attached again the "cobwin3.zip" (with minor changes) that contains all you need to test, except the VS environment (because each one has its own).
Now, I'll try to explain each item of your exposure above:
. got lots of COBOL errors which were resolved by adding -I copy to "cobol compiler main flags"
missing "libcobx.h" (my fault, may be in the forum somewhere)
Using the a VS console, change to directory "cobwin3":
SET INCLUDE=.\include;%INCLUDE%
...
. got "CobMain.cbl (45): error: typedef/SIZE_T: No such file or directory" resolved by hard-coding it to 4 for the following tests
VS variable types emulation (much like MF typedefs, but with COPY statements):
SET COBCPY=.\copy;%COBCPY%
Along with "copy" subdir there are 3 more subdirs:
"renum",
"T"
"typedef"
...
this lead to an old bug (SIGSEGV again...) of rw-branch integrated to 2.0 branch recently with [r1132] and is fixed there now with [r1154]
I saw it with rev 1047 for the 1st time...before 1132. See attachement at the beginning of this page.
...
got undefined references to lots of Windows API, solved by set COB_LIBS=libcob.lib USER32.LIB GDI32.LIB WINSPOOL.LIB COMDLG32.LIB ADVAPI32.LIB SHELL32.LIB OLE32.LIB OLEAUT32.LIB UUID.LIB ODBC32.LIB ODBCCP32.LIB USERENV.LIB SECUR32.LIB WS2_32.LIB COMCTL32.LIB (brute force, I would recommend to only use the ones needed)
This setting is scripted (taken from VS itself, with the same order and with some additions)
SET COB_LIBS=gci.lib libcob.lib libdb.lib mpir.lib pdcurses.lib USER32.LIB GDI32.LIB WINSPOOL.LIB COMDLG
32.LIB ADVAPI32.LIB SHELL32.LIB OLE32.LIB OLEAUT32.LIB UUID.LIB ODBC32.LIB ODBCCP32.LIB USERENV.LIB
SECUR32.LIB WS2_32.LIB COMCTL32.LIB
Never noticed relevant performance issues when compiling/linking.
...
got undefined references to LoadMenu@8 and _added _ -A "/FI libcobx.h" to cobflags
Missing #include <windows.h> (libcobx.h)
These functions are in "USER32.LIB"</windows.h>
...
this lead to redefinition errors for the static calls which were resolved by a new compiler flag to disable it (added with [r1155]) and adding the new -fno-gen-c-decl-static-call to cobflags, got a WinMain.exe
This new flag -fno-gen-c-decl-static-call is based on what, precisely? I saw an entry in "flags.def" that says "This new flag -fno-gen-c-decl-static-call (when "no-" omitted) "generate C function declations for subroutines with static CALL".
...
just for curiosity: activated "Add output exe name (This will give an obscure error when compiling)", got ListView.exe, no obscure error
See at the beginning of this page:
I noticed this behavior recently:
When adding "-o ListView.exe", in the command prompt, I get this absurd error:
executing: cl.exe /MD /Fe"ListView.exe" "WinMain.obj" "WinCon.obj"
"ListView.exe" "ListView.exe" "ListView_rc.obj" /link
^^^^^^^^^^^^^ ^^^^^^^^^^^^^
/manifest /nologo gci.lib libcob.lib calfaq.lib disphelper.lib
gc2disphelper.lib gc2winapi.lib japi.lib libdb.lib mpir.lib
pdcurses.lib USER32.LIB GDI32.LIB WINSPOOL.LIB COMDLG32.LIB
ADVAPI32.LIB SHELL32.LIB OLE32.LIB OLEAUT32.LIB UUID.LIB
ODBC32.LIB ODBCCP32.LIB USERENV.LIB SECUR32.LIB WS2_32.LIB
COMCTL32.LIB
cl : Command line warning D9024 : unrecognized source file type 'ListView.exe', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'ListView.exe', object file assumed
LINK : fatal error LNK1149: output filename matches input filename 'D:\DEV\MM\test2\cobwin3\ListView
.exe'
return status: 2
It puts the outputfile name twice as they were obj files. Don't ask me why...(It's a mystery to me). Nonetheless, I made some other tests without problems with -o <filename>.exe
...
Conclusion:
Still missing to solve the case of ...
"cob_get_global_ptr()->cob_call_params = 4"
in all C functions that calls cobol (WinMain.c).
I did (almost) everything you told me to and it works fine. Next test, all the other VS versions x86 and x64 platforms...
Thank you for reporting this and attaching the files to reproduce it. Please add a link to the original topic here, too.
I try to check this before the rc-1 but I can not guarantee that this will be fixed until then (as there is a TO-DO pile already) but it will before the 2.0 final.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a good time to necromance this thread, as @lefessan just pushed [r5208] which allows --include to include C headers (automatically disabling static call declarations)
Rev1041 compiled well (see note above) even though I had yet to set "cob_get_global_ptr()->cob_call_params = 4" before calling the cobol program from C (WinMain->CobMain), to work without problems. Starting in rev.1044 onwards, I could't compile it no more. And the error is weird "cobc: aborting compile of CobMain.cbl at line 1".
NOTE (about rev.1041 and probably below):
I noticed this behavior recently:
When adding "-o ListView.exe", in the command prompt, I get this absurd error:
executing: cl.exe /MD /Fe"ListView.exe" "WinMain.obj" "WinCon.obj"
"ListView.exe" "ListView.exe" "ListView_rc.obj" /link
/manifest /nologo gci.lib libcob.lib calfaq.lib disphelper.lib
gc2disphelper.lib gc2winapi.lib japi.lib libdb.lib mpir.lib
pdcurses.lib USER32.LIB GDI32.LIB WINSPOOL.LIB COMDLG32.LIB
ADVAPI32.LIB SHELL32.LIB OLE32.LIB OLEAUT32.LIB UUID.LIB
ODBC32.LIB ODBCCP32.LIB USERENV.LIB SECUR32.LIB WS2_32.LIB
COMCTL32.LIB
cl : Command line warning D9024 : unrecognized source file type 'ListView.exe', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'ListView.exe', object file assumed
LINK : fatal error LNK1149: output filename matches input filename 'D:\DEV\MM\test2\cobwin3\ListView
.exe'
return status: 2
I'll attach the files when replying to "me"
Cheers,
MM
Attached files...
WinMain.c doesn't compile here:
To fix the C compiler warning
include <windows.h>
. Leads to the following warnings but compiles:Nonetheless I'm investigating the SIGSEGV now.
Last edit: Simon Sobisch 2016-10-12
Initially, this example was made using "VC2010" and not "VC2015" (which you are using) or any other version. I'm testing now the remainig variants but also found "some" problems. "VC2010" sporadically (I'm testing the others too) seems not to like the name "CALL-CONVENTION" statement, hence (once in a while) when compiling, it showns something like "<program-name>.cbl (19): error: invalid system-name 'CALL-CONVENTIONY½!gìþ'" <- gibberish (memory corruption?) and a bunch of error related with WINAPI. VS2015, on the other hand does many complaints with code made for previous compilers. The example you gave to me showed that, when compiled with VS2010 there is "code" before variable declarations or was not compiled in C++ mode (instead of C mode only which is the default). I'm not sure (I had many of those). Nonetheless, I didn't see anything wrong(?). This is one more thing to check out. Nonetheless, I'm going to give you the "replication" of my example as soon as possible. They are somewhat "tricky" and have many dependencies (use one directory of your choice. When I'm ready, I'll give you a link to my "cloud" folder to download its content.
BTW: You only need to include "libcob.h" and "libcobx.h" when compiling (only) "WinMain.c", just like (I'll attach those):
SET INCLUDE=<directory_which_contains_libcob_h>;%INCLUDE
cl /c -D_DEBUG -wd4047 -wd4024 -wd4133 /MD /Fo"WinMain.obj" "WinMain.c"
cl /c WinMain.c
It shouldn't give any error in any version of VS.
Like we say in Portugal:
Who don't cry, don't suck!
Cheers,
MM
Last edit: Mário Matos 2016-10-12
I've fixed the "memory corruption gibberish" with the same revision as the SIGSEGV.
... and if possible you should keep library headers clean (the informatin I've patched libcob.h was missing - and I see no problem in including libcobx.h in your WinMain.c).
Well, yes, you have a point there. I'll do that, but first I'll wait you to implement the INCLUDE .h files in cobol source. Anyways, "libcob.h" is only a starting point (and don't bother anyone, except you) and we are working in multiplatform (there's allways an IF). Sergey did that too with "mpir.h". (do you remember?). I'll remember you with the following attachement:
Cheers,
MM
PS: This goes for all of us, whether Tyrians or Trojans, although I am not sure whether there are any Tyrians and Trojans here.
I didn't found the feature-request about the include possibility. Can you please check/add a feature request for this? Are there other compilers directly allowing this? If not we could use an implementor defined preprocessor directive like
>> IMP INCLUDE stuff.h
.My current thoughts were about adding a command line option but we may should do both (internally using the same function).
We likely should deactivate the C function prototype generation for static calls as soon as we find any C header (otherwise we'd likely produce multiple declarations).
And yes, I remember the mpir.h part in CPP version but have to say that MPIR team strictly advises to don't do so but to configure MPIR with gmp-compat instead (when it is used as GMP replacement). This is the reason I did not merged this part to the 2.0 line.
There never was a feature-request about this but there was an "idea" that came from you about the inclusion of a -H or a --headerinclude <file> (which Brian didn't like very much, for timing reasons) here:
https://sourceforge.net/p/open-cobol/discussion/cobol/thread/aecd70bd/
Nonetheless the
>>IMP INCLUDE stuff.h
you refered seems to be even a better idea.If you want, I'll create a ticket in the Wish-list".
But, most important now is the inclusion of "libcobx.h" (or its code) in "libcob.h". This is of the most importance when dealing with WINAPIs because if I don't, I'll receive a bunch of "unresolved externals" from the cobol objects (when linking all together).
See what I mean?
The APIs above are executed using
CALL WINAPI "c_api_func" USING ... END-CALL
so,#include <windows.h>
must be included anywhere in "libcob.h" or anywhere when the C code is to be generated.What the generated C code have is something like this:
Further WINAPI functions, like:
etc. will be dismissed.
Cheers,
MM
Last edit: Simon Sobisch 2016-10-13
Yes, please create the feature request (with a target for GC2.1) containing both the command line option for including it in the local header files and the preprocessor directive to do the same.
And please include the workaround (which I highly suggest you to use): force the inclusion of the header with the C compiler.
The option for GCC:
--include stuff.h
The option for MSC:
/FI stuff.h
You have three possibilities to do so:
1) before building: change defaults.h to include these in the COB_CFLAGS
only useful if you want to add these for every single program (this is similar to hacking libcbo.h - I wouldn't recommend both variants) and if you do so you likely want to hack COB_LDFLAGS, too and adding libraries there
2) temporary via environment: set the environment options (likely get the default first via
cobc --info
and only add/adjust) - influences all compilations you do in this shell afterwards3) recommended: add this directly on the command line via
cobc -A "/FI winlibs.h" ...
Hi, Simon
I opted for the 3rd. I like to put things in my CMD scripts...
/FI stuff.h will be!!!
Cheers,
MM
Do you still have any issues with the latest svn revision? For example the -o issue?
Please add the workaround options for INCLUDE to the ticket, too. Thank you.
Used GnuCOBOL 2.0.1155 with all 3 tests with VS 2010-12-13-15 in both x86 and x64. Now, "libcob.h" is clean. I'll test further versions (in time). All I could see went well. I'll attach them all... The -o issue "is no more" for the time beeing. About the "ticket", I added one to the "Wish-list" if it's what you mean:
https://sourceforge.net/p/open-cobol/feature-requests/176/
Am I missing something? Do you need more information I may have inadvertently omitted?
Cheers,
MM
I've used your sample and run
_make.cmd
and had some adjustments to do:-I copy
to "cobol compiler main flags"CobMain.cbl (45): error: typedef/SIZE_T: No such file or directory
resolved by hard-coding it to 4 for the following testsset COB_LIBS=libcob.lib USER32.LIB GDI32.LIB WINSPOOL.LIB COMDLG32.LIB ADVAPI32.LIB SHELL32.LIB OLE32.LIB OLEAUT32.LIB UUID.LIB ODBC32.LIB ODBCCP32.LIB USERENV.LIB SECUR32.LIB WS2_32.LIB COMCTL32.LIB
(brute force, I would recommend to only use the ones needed)LoadMenu@8
and_DialogBoxA@16
, added-A "/FI libcobx.h"
to__cobflags__
-fno-gen-c-decl-static-call
to__cobflags__
, got a WinMain.exeAre there any more issues you see with the current svn version when using an unpatched libcob and the flags
-A "/FI libcobx.h" -fno-gen-c-decl-static-call
?I would first like to show my appreciation for the effort you applied in this peculiar matter.
Note that I attached again the "cobwin3.zip" (with minor changes) that contains all you need to test, except the VS environment (because each one has its own).
Now, I'll try to explain each item of your exposure above:
. got lots of COBOL errors which were resolved by adding
-I copy
to "cobol compiler main flags"missing "libcobx.h" (my fault, may be in the forum somewhere)
Using the a VS console, change to directory "cobwin3":
SET INCLUDE=.\include;%INCLUDE%
...
. got "CobMain.cbl (45): error: typedef/SIZE_T: No such file or directory" resolved by hard-coding it to 4 for the following tests
VS variable types emulation (much like MF typedefs, but with COPY statements):
SET COBCPY=.\copy;%COBCPY%
Along with "copy" subdir there are 3 more subdirs:
"renum",
"T"
"typedef"
...
this lead to an old bug (SIGSEGV again...) of rw-branch integrated to 2.0 branch recently with [r1132] and is fixed there now with [r1154]
I saw it with rev 1047 for the 1st time...before 1132. See attachement at the beginning of this page.
...
got undefined references to lots of Windows API, solved by set COB_LIBS=libcob.lib USER32.LIB GDI32.LIB WINSPOOL.LIB COMDLG32.LIB ADVAPI32.LIB SHELL32.LIB OLE32.LIB OLEAUT32.LIB UUID.LIB ODBC32.LIB ODBCCP32.LIB USERENV.LIB SECUR32.LIB WS2_32.LIB COMCTL32.LIB (brute force, I would recommend to only use the ones needed)
This setting is scripted (taken from VS itself, with the same order and with some additions)
SET COB_LIBS=gci.lib libcob.lib libdb.lib mpir.lib pdcurses.lib USER32.LIB GDI32.LIB WINSPOOL.LIB COMDLG
32.LIB ADVAPI32.LIB SHELL32.LIB OLE32.LIB OLEAUT32.LIB UUID.LIB ODBC32.LIB ODBCCP32.LIB USERENV.LIB
SECUR32.LIB WS2_32.LIB COMCTL32.LIB
Never noticed relevant performance issues when compiling/linking.
...
got undefined references to
LoadMenu@8
and _added _-A "/FI libcobx.h"
to cobflagsMissing #include <windows.h> (libcobx.h)
These functions are in "USER32.LIB"</windows.h>
...
this lead to redefinition errors for the static calls which were resolved by a new compiler flag to disable it (added with [r1155]) and adding the new -fno-gen-c-decl-static-call to cobflags, got a WinMain.exe
This new flag
-fno-gen-c-decl-static-call
is based on what, precisely? I saw an entry in "flags.def" that says "This new flag-fno-gen-c-decl-static-call
(when "no-" omitted) "generate C function declations for subroutines with static CALL"....
just for curiosity: activated "Add output exe name (This will give an obscure error when compiling)", got ListView.exe, no obscure error
See at the beginning of this page:
It puts the outputfile name twice as they were obj files. Don't ask me why...(It's a mystery to me). Nonetheless, I made some other tests without problems with
-o <filename>.exe
...
Conclusion:
Still missing to solve the case of ...
"cob_get_global_ptr()->cob_call_params = 4"
in all C functions that calls cobol (WinMain.c).
I did (almost) everything you told me to and it works fine. Next test, all the other VS versions x86 and x64 platforms...
Stay tune...
Cheers,
MM
Last edit: Simon Sobisch 2024-01-31
Thank you for reporting this and attaching the files to reproduce it. Please add a link to the original topic here, too.
I try to check this before the rc-1 but I can not guarantee that this will be fixed until then (as there is a TO-DO pile already) but it will before the 2.0 final.
And all began here:
https://sourceforge.net/p/open-cobol/discussion/cobol/thread/d8730ee2/
before here:
https://sourceforge.net/p/open-cobol/discussion/cobol/thread/71e7e72a/
After the stir with the COPY statement with 2 dots which has been reverted.
...and take your time. I'll use whichever revision that serves my purposes.
Cheers,
MM
Minor bug corrected in "S_PAINTSTRUCT.cpy" to include in "copy/T" directory of "cobwin3.zip".
MM
This is a good time to necromance this thread, as @lefessan just pushed [r5208] which allows
--include
to include C headers (automatically disabling static call declarations)Related
Commit: [r5208]