Page 1 of 1

Compiler related Procedure Extensions

Posted: Sat Sep 23, 2006 7:03 am
by va!n
Afaik, there are some compiler related procedure extensions, like "_MMX" "_Unicode" ... Is there any way to use an includefile like following small example and using the specific procedure named Test() instead using Test(), Test_MMX() and so on? Or does this only work for compiled libs? o_O

Code: Select all

Procedure Test()
  ProcedureReturn 1
EndProcedure

Procedure Test_Unicode()
  ProcedureReturn 2
EndProcedure

Procedure Test_MMX()
  ProcedureReturn 3
EndProcedure

Debug Test()

Posted: Sat Sep 23, 2006 10:07 am
by Trond
You can already do this for the _Unicode procedure by using CompilerIf and #PB_Compiler_Unicode.

Posted: Sat Sep 23, 2006 10:46 am
by va!n
yes, i know about the CompilerIf thing... thanks... but as PB support procedure extensions too, isnt there any other way as i shown in my small code example? does the code example only works for compiled libs? Afaik you can split commands by using YourProcedure() and YourProcedure_Unicode() for example... same for some other stuff like MMX and so on....

Posted: Sat Sep 23, 2006 12:13 pm
by remi_meier
You could do the same as PB does. Create a jump table with prototypes
that you initialize at the start of your program according to the current
CPU features.

Code: Select all

Prototype Test()
global Test.Test

if IsMMX()
  Test = @Test_MMX()
else
  Test = @Test()
Endif
But I don't think there is another easy way.