Author Topic: No UDT's as macro parameters allowed  (Read 1778 times)

0 Members and 1 Guest are viewing this topic.

Brian Alvarez

  • Guest
No UDT's as macro parameters allowed
« on: December 14, 2018, 06:25:32 PM »
 This has been giving me trouble. apparently Oxygen hates when UDT variables are passed as macro parameters and commits suicide.

Code: [Select]
   SOMEUDT u1

   A_MACRO(u1, b, c, d)

 It consistently crashes. even worse when its an array of UDT's.
Please give it a check when you can? If not too difficult?

 I am trying to implement TYPE SET.

Brian Alvarez

  • Guest
Re: No UDT's as macro parameters allowed
« Reply #1 on: December 14, 2018, 06:46:14 PM »
Example:

Code: [Select]
'Generated with PluriBASIC 6.0.74371.0

$ filename "MACROUDTS.exe"

uses rtl64

TYPE UDT1
    CHAR x[12]
END TYPE

MACRO SOMEMACRO(a)

END MACRO

UDT1 u1

somemacro(u1)
 
FUNCTION PBMAIN() AS INT
   INT _FUNCTION = 0
END FUNCTION

PBMAIN() ' invoke entry point

Brian Alvarez

  • Guest
Re: No UDT's as macro parameters allowed
« Reply #2 on: December 14, 2018, 06:51:44 PM »
Oddly, in some of my bigger examples, using UDTs in macros are completely fine, so, something else must be fixing the issue.

Brian Alvarez

  • Guest
Re: No UDT's as macro parameters allowed
« Reply #3 on: December 14, 2018, 06:56:58 PM »
Wow. Actually this is also crashing:

Code: [Select]
$ filename "MACROUDTS.exe"

uses rtl64

macro somemacro(u1)
end macro

long a

somemacro(a)

Maybe empty macros are killing it... this fixes the crash for normal variables:

Code: [Select]
macro somemacro(u1)
    u1 = 1
end macro

Charles Pegge

  • Guest
Re: No UDT's as macro parameters allowed
« Reply #4 on: December 14, 2018, 08:33:43 PM »
Hi Brian,

There was a substitution problem with empty macros.

Now Fixed:

https://github.com/Charles-Pegge/OxygenBasic/blob/master/OXSC181215.zip
« Last Edit: December 14, 2018, 09:01:53 PM by Charles Pegge »

Brian Alvarez

  • Guest
Re: No UDT's as macro parameters allowed
« Reply #5 on: December 15, 2018, 06:45:15 AM »
Thanks charles! You are a trouper :)