lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


if you include <stdint.h> you can use the type "intptr_t" for the cast. "intptr_t" is a signed integer type that's the same size as a pointer. On 32-bit windows this would be defined as a "long", on 64-bit windows as a "long long", and on Unix/Linux systems (both 32 and 64 bit) as a "long" as well.

On Fri, Nov 12, 2021 at 6:27 PM Kaz F <kaz.foxsen@gmail.com> wrote:

Getting rid of ‘IupControlsClose’ allowed me to compile an .exe with tasks.json, so I don’t even need to bother with the Makefile stuff.

 

I still do get a warning about the C file:

 

    if ((int)(info.hInstApp) > 32) {

lua_pushboolean(l,1);

return 1;

    }

 

This gives the warning “cast from pointer to integer of different size [-Wpointer-to-int-cast]”. Is there a way to rewrite this to stop the warning?

 

 

From: nerditation
Sent: Friday, November 5, 2021 12:55 PM
To: lua-l@lists.lua.org
Subject: Re: I Can't Get Lua 5.1 and IUP 3.30 to Work With VSCode and GCC on Windows 10 x64

 

On 2021/11/5 12:53, Kaz F wrote:

>  

>

> If it helps, this is the problem area in the C file:

>

>  

>

> #ifndef IUPLUA_NO_CD

>

>   cdlua_close(L);

>

>    IupClose();

>

> #endif

>

>   IupControlsClose();

>

>  

>

> I saw elsewhere (http://lua-users.org/lists/lua-l/2005-03/msg00395.html <http://lua-users.org/lists/lua-l/2005-03/msg00395.html>) IupControlsClose being used before IupClose, but swapping them in my C script didn’t fix it.

>

>  

>

> I did see ‘IUP_CLOSE’ in libiupcontrols.a (opened in Notepad), but none of my files have ‘IupControlsClose’.

>

 

 

you see, according to the change log on iup website, `IupControlsClose` was deprecated in iup 3.0-beta1,

and removed in version 3.19. so I guess your original code was written for iup version earlier than 3.19,

or maybe even for version 2.x. since you only got a link error, but not a compile error, I suppose it's

not only that you may be missing some linker arguments, but you might have also included the wrong header

from different or mixed library versions.

 

it seems that you are not very comfortable dealing with C code and GNU toolchain. so, I suggest you either:

 

a) hand over the project to someone who is is more familiar with GCC, or

b) you figure out the original iup version and stick with a compatible version instead of the latest.

 

bottom line is, even for experienced C programmer, it's not a trivial task to migrate a project over

incompatible versions, let alone for someone who don't even fully understand compiler error messages.

programmers in general prefer writing new code to maintaining legacy code base, because maintaining

old code base is usually less fun.

 



--