01 May 2023, 14:38 | #1 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,438
|
Question about XREF vs XDEF (vasm 1.8 vs vasm 1.9)
I've run into a small problem when upgrading from vasm 1.8l to vasm 1.9d. In my code, I've so far used the following rules for .i files and .asm files:
In vasm 1.9d this no longer works and gives errors like "external symbal <name> must not be defined". So the questions I have are twofold:
|
01 May 2023, 15:40 | #2 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,643
|
I suspect this could be due to my post here.
Let's see if phx steps in with a solution - he didn't say in the linked thread if he added a flag for this to enable previous behavior or not. Otherwise you could use a technique similar to shared library includes where the include file defaults to import the symbol (xref) if some preprocessor symbol isn't defined, and export (xdef) if it is defined - you would then define the preprocessor symbol when you build the file that defines the symbols in the include file. |
01 May 2023, 15:53 | #3 | |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,068
|
Quote:
So if I understand this correctly, you are only using XREFs, and vasm is able to deduct that if any of those symbols are found it automatically "generates' corresponding XDEFs to export them? If you want to use the same file for both your build and user build, I'd do similar to what I do in c/c++. When you are building the code, define a symbol e.g. BUILD_XXX and then in your .i files: Code:
XDEFREF MACRO IFD BUILD_XXX XDEF \1 ELSE XREF \1 ENDC ENDM XDEFREF myfn1 XDEFREF myfn2 ... Last edited by BippyM; 01 May 2023 at 21:52. |
|
01 May 2023, 16:11 | #4 | ||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,438
|
Wow, learn something new every day - but not all you learn makes you happy I suppose
Quote:
Put XREF's to all routines from an .asm file in a .i file (together with the rest of the interface such as structure definitions & constants), include the .i file in the .asm file it references and then include the .i file in every file that uses the routines from said object/asm file. I'm 100% certain I didn't think this method up by myself, but I don't remember where I first saw it being used. Quote:
Edit: actually, that probably works, although I might want to change it a bit for my purposes. |
||
01 May 2023, 16:12 | #5 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,358
|
Normally there is public keyword that can replace both xref and xdef. PhxAss supports it, its successor probably should as well.
|
01 May 2023, 16:17 | #6 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,643
|
|
01 May 2023, 16:45 | #7 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,438
|
|
01 May 2023, 18:04 | #8 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,551
|
Quote:
Roondar's experience is completely my fault, because I implemented xdefand xrefboth lazily with the same code, like a globalor publicdirective. This works with legal code, of course, but it allows illegal usage of these directives, which Roondar unfortunately exploited. Maybe others did that too and I'm sorry about that. Fortunately hooverphonique finally made me fix it. So the current behaviour is now 100% compatible with all other assemblers. Yes. This will work as before, and uses the same code as xdef/xref did before. But note, that this is not a common 68k assembler directive. It is unknown to Devpac, for example. So, if you want to write portable 68k source, I would stick to xdef/xref. |
|
01 May 2023, 20:59 | #9 | ||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,438
|
Quote:
Quote:
|
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question about NEAR directive in vasm | dansalvato | Coders. Asm / Hardware | 2 | 18 March 2022 12:40 |
Another Vasm question | LeCaravage | Coders. Asm / Hardware | 7 | 27 January 2021 23:30 |
bug in vasm 1.8h or not... | JoeJoe | Coders. Asm / Hardware | 3 | 25 September 2020 12:05 |
vasm question | marduk_kurios | Coders. Asm / Hardware | 7 | 14 February 2014 20:06 |
vasm 1.5 RFC | phx | Coders. General | 30 | 11 December 2010 02:08 |
|
|