Is is possible to import C files that use inline assembly into bmax?
Here is an example of what I am trying to do, but gives the error: cpuspeed.c:12: parse error before "_emit"
Am I doing something wrong or should I put the C function in a dll instead? (this is not possible in bmax)
Here is an example of what I am trying to do, but gives the error: cpuspeed.c:12: parse error before "_emit"
//---- file: cpuspeed.c ---- #include <windows.h> int CpuSpeed(void) { unsigned __int64 start, stop; unsigned __int64 nCtr, nFreq, nCtrStop; QueryPerformanceFrequency((LARGE_INTEGER *)&nFreq); __asm _emit 0x0F __asm _emit 0x31 __asm mov DWORD PTR start, eax __asm mov DWORD PTR [start+4], edx QueryPerformanceCounter((LARGE_INTEGER *)&nCtrStop); nCtrStop += nFreq; do { QueryPerformanceCounter((LARGE_INTEGER *)&nCtr); } while (nCtr < nCtrStop); __asm _emit 0x0F __asm _emit 0x31 __asm mov DWORD PTR stop, eax __asm mov DWORD PTR [stop+4], edx return ((stop-start)/1000000); }
'---- file: test.bmx ---- Import "cpuspeed.c" Extern Function CpuSpeed() End Extern Print "Cpu Speed: "+CpuSpeed()+" Mhz"
Am I doing something wrong or should I put the C function in a dll instead? (this is not possible in bmax)