Skip to content

x64 does not build using CL #26

@NaruFGT

Description

@NaruFGT

I don't want to install codeblocks so I just took a look at the cbp and it looks very straightforward so I reviewed the code and found the required libraries: user32, advapi32, and shell32 so this should be as simple as cl *.cpp /link user32.lib advapi32.lib shell32.lib /OUT:cmdow.EXE
so I tried that, and I saw some concerning warnings...

Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

args.cpp
args.cpp(256): warning C4312: 'type cast': conversion from 'unsigned long' to 'HWND' of greater size
help.cpp
main.cpp
tlist.cpp
tlist.cpp(126): warning C4311: 'type cast': pointer truncation from 'PPERF_DATA_BLOCK' to 'DWORD'
tlist.cpp(126): warning C4312: 'type cast': conversion from 'unsigned long' to 'PPERF_OBJECT_TYPE' of greater size
tlist.cpp(127): warning C4311: 'type cast': pointer truncation from 'PPERF_OBJECT_TYPE' to 'DWORD'
tlist.cpp(127): warning C4312: 'type cast': conversion from 'unsigned long' to 'PPERF_COUNTER_DEFINITION' of greater size
tlist.cpp(138): warning C4311: 'type cast': pointer truncation from 'PPERF_OBJECT_TYPE' to 'DWORD'
tlist.cpp(138): warning C4312: 'type cast': conversion from 'unsigned long' to 'PPERF_INSTANCE_DEFINITION' of greater size
tlist.cpp(142): warning C4311: 'type cast': pointer truncation from 'PPERF_INSTANCE_DEFINITION' to 'DWORD'
tlist.cpp(142): warning C4312: 'type cast': conversion from 'unsigned long' to 'LPSTR' of greater size
tlist.cpp(154): warning C4311: 'type cast': pointer truncation from 'PPERF_INSTANCE_DEFINITION' to 'DWORD'
tlist.cpp(154): warning C4312: 'type cast': conversion from 'unsigned long' to 'PPERF_COUNTER_BLOCK' of greater size
tlist.cpp(155): warning C4311: 'type cast': pointer truncation from 'PPERF_COUNTER_BLOCK' to 'DWORD'
tlist.cpp(155): warning C4312: 'type cast': conversion from 'unsigned long' to 'LPDWORD' of greater size
tlist.cpp(156): warning C4311: 'type cast': pointer truncation from 'PPERF_COUNTER_BLOCK' to 'DWORD'
tlist.cpp(156): warning C4312: 'type cast': conversion from 'unsigned long' to 'PPERF_INSTANCE_DEFINITION' of greater size
wlist.cpp
wlist.cpp(263): warning C4311: 'type cast': pointer truncation from 'HWND' to 'unsigned long'
wlist.cpp(497): warning C4311: 'type cast': pointer truncation from 'HWND' to 'long'
wlist.cpp(600): warning C4311: 'type cast': pointer truncation from 'HINSTANCE' to 'int'
Generating Code...
Microsoft (R) Incremental Linker Version 14.27.29111.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:args.exe 
user32.lib 
advapi32.lib 
shell32.lib 
/OUT:cmdow.EXE 
args.obj 
help.obj 
main.obj 
tlist.obj 
wlist.obj 

well warnings aren't build errors so I figured let's just give it a try
cmdow no output cmdow /t no output...
Well I guess there's something not right here. I switch to x86 cross tools and link to the 32 bit versions of these libraries using the same command and it works? Builds with no warnings:

Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

args.cpp
help.cpp
main.cpp
tlist.cpp
wlist.cpp
Generating Code...
Microsoft (R) Incremental Linker Version 14.27.29111.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:args.exe
user32.lib
advapi32.lib
shell32.lib
/OUT:cmdow.EXE
args.obj
help.obj
main.obj
tlist.obj
wlist.obj

So for one reason or another there are changes to the Windows API that prevents your program from running if linked to x64 libraries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions