You can include different versions of the same function for different CPUs, which will be automatically called depending on the CPU of the computer which executes the program (if dynamic CPU is selected when creating the executable). PureBasic allows four different versions: MMX, 3DNOW, SSE and SSE2:
Note that the only way to take some advantage of this is to use CPU-specific inline ASM, so this possibility is not very useful here, but since the Library SDK offers it, TailBite makes it available to you also just in case you need it, which I doubt. Anyway, this is how it works:
ProcedureDLL MyDiv(a, b) ProcedureReturn a/b EndProcedure ProcedureDLL MyDiv_MMX(a, b) ; MMX code here ProcedureReturn a/b EndProcedure ProcedureDLL MyDiv_3DNow(a, b) ; 3DNow code here ProcedureReturn a/b EndProcedure ProcedureDLL MyDiv_SSE(a, b) ; SSE code here ProcedureReturn a/b EndProcedure ProcedureDLL MyDiv_SSE2(a, b) ; SSE2 code here ProcedureReturn a/b EndProcedure ProcedureCDLL MyDiv_DEBUG(a, b) If b=0 TB_DebugError(@"Division by zero!") EndIf EndProcedure
As you can see in the above example, only one debug function is allowed (it doesn't make sense to add more, there you mostly check only the arguments, don't you?).
You can, of course, include variable argument number versions also here (MyDiv2_SSE2
and so on), but I guess you got the point.