English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 23 January 2022, 00:14   #1
Warty
Registered User
 
Join Date: Aug 2018
Location: Minneapolis, USA
Posts: 301
Using Memwatch with VBCC?

Does anyone know if its possible to get memwatch compiling under VBCC?

(building against 3.2.1 and NDK 3.2)

If I only include memwatch when compiling with SAS/c, that compiler compiles fine and works. (I have other troubles with my SAS/C install that make it super unstable, so I would really like to get it working under VBCC).

When I try to include it in a VBCC build, I get compiler errors like this:
Quote:
vbccm68k -c99 -quiet -hunkdebug "app.c" -o= "/var/tmp/tmp.1.asm" -g -prof -O=1 -I"$VBCC/targets/m68k-amigaos/include" -I"$VBCC/ndk32/Include/include_h" -I"$VBCC/p96/Include" -I"$VBCC/memwatch/Include" failed
VBCC build script complete

>typedef unsigned int size_t;
warning 226 in line 13 of "sys/commsize.h": redeclaration of typedef <size_t>
included from file "/opt/vbcc/memwatch/Include/dos.h":29
included from file "/opt/vbcc/memwatch/Include/memwatch.h":20
included from file "about_window.c":61
>typedef unsigned int size_t;
warning 226 in line 13 of "sys/commsize.h": redeclaration of typedef <size_t>
included from file "/opt/vbcc/memwatch/Include/dos.h":29
included from file "/opt/vbcc/memwatch/Include/memwatch.h":20
included from file "app.c":81
> MWInit(NULL, MWF_CHECK, NULL);
error 39 in line 1898 of "app.c": invalid types for assignment
1 error found!
If I make a copy of memwatch and put it with my projects files, comment out the dos.h, stdlib.h, and string.h includes in memwatch.h, it will compile, but calloc() calls fails (presumably all memory stuff does).

I've tried a few things, but have never got this to work with VBCC.

MemWatch ref:
MWDEBUG (MemLib) from Amiga World Tech Journal vol1no2 1991. http://aminet.net/package/dev/debug/memlib.
Warty is offline  
Old 23 January 2022, 06:32   #2
Hedeon
Semi-Retired
 
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 1,993
Sounds like an include issue. There is no dos.h in the memwatch distribution so I am not sure why the output is giving a dos.h in /opt/vbcc/memwatch/Include/

Should be something like ndk32/Include/include_h/dos/dos.h within the VBCC path

calloc is I think part of stdlib and the includes are at targets/m68k-amigaos/include within the VBCC path.

The MWInit probably fails on a faulty define of either NULL or MWF_CHECK or is a result from the typedef redecleration warning earlier. NULL is defined in types.h.

This without looking at the actual source.
Hedeon is offline  
Old 23 January 2022, 12:46   #3
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
There are multiple problems. MemWatch seems very SAS/C-specific. You have to port the whole project to vbcc first. The included memwatch.lib also only works with SAS/C.

What I spotted immediately:

1. SAS/C constructors/destructors _STI_240_MWInit(), _STD_240_MWTerm(), etc. have to be changed. vlink recognizes these functions by _INIT_<pri>_<name> and _EXIT_<pri>_<name>. Without a working constructor the library is useless.

2. memwatch.h redefines memory functions (AllocMem, FreeMem, malloc, etc.) by macros. This cannot work when including vbcc's <proto/xyz.h>, because it also uses macros to define all OS calls with inline assembly. There will be redefinition errors.

3. dos.h (without path) is SAS/C specific and does neither exist in the NDK nor in vbcc. Did you copy it over? I assume it declares some POSIX support functions for SAS/C? sys/commsize.h is also from SAS/C, which certainly defines size_t differently than vbcc does. There is PosixLib for vbcc on Aminet, but you shouldn't need any POSIX stuff for MemWatch, when properly ported.

4. In vbcc NULL is defined as ((void *)0), and not simply as 0L, to make sure it is used for pointers only. This might cause conflicts as well.
phx is offline  
Old 23 January 2022, 17:44   #4
Warty
Registered User
 
Join Date: Aug 2018
Location: Minneapolis, USA
Posts: 301
Thanks for looking phx.

ah. I was afraid it might be something like that. Makes sense that it would have a lot of SAS/C-specific things in it: I believe the author was working for SAS/C at the time.

I think I will probably invest time in getting my program running more stably in the SAS/C build rather than try to make memwatch work under VBCC.
Warty is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
vbcc memwatch, debugging, symbols carrion Coders. C/C++ 8 17 April 2021 11:43
vbcc 0.9d phx News 43 13 July 2015 19:41
Memwatch functions in Action Replay III don't work in WinUAE Galahad/FLT support.WinUAE 12 11 May 2014 13:42
Memwatch+Arcadia thor support.WinUAE 4 28 December 2013 17:28
Winuae - (debugger) Memwatch Problem barny support.WinUAE 2 03 October 2005 12:30

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 23:12.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10084 seconds with 13 queries