How to be sure my executable and dlls are both 32-bit

General questions regarding the usage of CodeLite
ColleenKobe
CodeLite Veteran
Posts: 95
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

How to be sure my executable and dlls are both 32-bit

Postby ColleenKobe » Fri Jun 15, 2018 9:50 pm

I'm posting this question on the wxCodeLite forum because the people here are likeliest to use the same coding environment that I use.

I have a large, complicated CodeLite workspace that until recently was compiling and building fine. Then, after a disastrous execution, my program hung and the only way to recover was cycling power. Very bad. Now whenever I run, I get error number 0xc000007b, which seems to be a default error number when no other error applies.

There are many sites online that offer suggestions to fix the problem. One of these sites hints that my dlls might be built for 32-bit execution, but the executable is being built for 64 bits. Or vice versa.

So I need to be sure that I am doing everything possible during compiling, linking, and building, to produce an entirely 32-bit executable.

My coding environment is as follows.

* Development and target execution platform: Windows 10, currently in Test Mode.

* MinGW 32-bit: downloaded from https://sourceforge.net/projects/mingw/ last update 2018-04-03

* wxWidgets: downloaded from https://www.wxwidgets.org/downloads/ latest development release, version 3.1.1. Compiled fresh on my computer using the MinGW 32-bit version above, and the link files that came with wxWidgets. The DOS commands to produce the Debug and Release versions were:

Code: Select all

echo on
cls

set PATH=C:\MinGW\bin;%PATH%
set WXWIN=C:\wxWidgets
set WXCFG=gcc_dll\mswud

C:
cd %WXWIN%\build\msw
IF EXIST C:\wxWidgets\lib\gcc_lib\mswu\wx\setup-old.h del C:\wxWidgets\lib\gcc_lib\mswu\wx\setup-old.h
IF EXIST C:\wxWidgets\lib\gcc_dll\mswu\wx\setup-old.h del C:\wxWidgets\lib\gcc_dll\mswu\wx\setup-old.h
IF EXIST C:\wxWidgets\lib\gcc_lib\mswu\wx\setup.h ren C:\wxWidgets\lib\gcc_lib\mswu\wx\setup.h setup-old.h
IF EXIST C:\wxWidgets\lib\gcc_dll\mswu\wx\setup.h ren C:\wxWidgets\lib\gcc_dll\mswu\wx\setup.h setup-old.h

mingw32-make -f makefile.gcc setup_h SHARED=1 UNICODE=1 BUILD=release VENDOR=cl
mingw32-make -j8 -f Makefile.gcc SHARED=1 UNICODE=1 BUILD=release VENDOR=cl CXXFLAGS="-fno-keep-inline-dllexport -std=c++11"

C:
cd C:\wxWidgets\build\msw
IF EXIST C:\wxWidgets\lib\gcc_lib\mswud\wx\setup-old.h del C:\wxWidgets\lib\gcc_lib\mswud\wx\setup-old.h
IF EXIST C:\wxWidgets\lib\gcc_dll\mswud\wx\setup-old.h del C:\wxWidgets\lib\gcc_dll\mswud\wx\setup-old.h
IF EXIST C:\wxWidgets\lib\gcc_lib\mswud\wx\setup.h ren C:\wxWidgets\lib\gcc_lib\mswud\wx\setup.h setup-old.h
IF EXIST C:\wxWidgets\lib\gcc_dll\mswud\wx\setup.h ren C:\wxWidgets\lib\gcc_dll\mswud\wx\setup.h setup-old.h

mingw32-make -f makefile.gcc setup_h SHARED=1 UNICODE=1 BUILD=debug VENDOR=cl
mingw32-make -j8 -f Makefile.gcc SHARED=1 UNICODE=1 BUILD=debug VENDOR=cl CXXFLAGS="-fno-keep-inline-dllexport -std=c++11"

echo    Done!


* CodeLite: downloaded from https://downloads.codelite.org/ Weekly build, version 12.0.3; I downloaded the "Windows Installer 64 bit," because I didn't see any other Windows option. I'm not sure if "64 bit" here is referring to the executable itself being 64 bits, or the program(s) it produces being 64 bits.

Is there anything else I need to do to verify my code produces a 32-bit program? I did not see any compiler or linker options in CodeLite.

Thanks!
Colleen
marcelinux
CodeLite Enthusiast
Posts: 15
Joined: Mon Nov 02, 2015 3:26 pm
Genuine User: Yes
IDE Question: C++
Location: Spain
Contact:

Re: How to be sure my executable and dlls are both 32-bit

Postby marcelinux » Sat Jun 16, 2018 11:49 am

I'm not an C++ expert. My apologice if I'm wrong. Searching in the GCC manual, I loocked https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/x86-Options.html#x86-Options
where -m32 option could do the trick.
These ‘-m’ switches are supported in addition to the above on x86-64 processors in 64-bit environments.

-m32
-m64
-mx32
-m16
-miamcu

Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32 option sets int, long, and pointer types to 32 bits, and generates code that runs on any i386 system.

The -m64 option sets int to 32 bits and long and pointer types to 64 bits, and generates code for the x86-64 architecture. For Darwin only the -m64 option also turns off the -fno-pic and -mdynamic-no-pic options.

The -mx32 option sets int, long, and pointer types to 32 bits, and generates code for the x86-64 architecture.

The -m16 option is the same as -m32, except for that it outputs the .code16gcc assembly directive at the beginning of the assembly output so that the binary can run in 16-bit mode.

The -miamcu option generates code which conforms to Intel MCU psABI. It requires the -m32 option to be turned on.

Who is online

Users browsing this forum: No registered users and 10 guests