March 28, 2024, 02:34:13 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Sample missing from archive

Started by Ionic Wind Support Team, September 03, 2007, 07:51:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ionic Wind Support Team

A sample program that didn't make it into the install.  c_dll.cba


'Using the C runtime DLL with Creative BASIC.
' All functions in the C runtime DLL (crtdll.dll) are CDECL so you need to tell
' Creative BASIC to use that calling method by specifying the ! symbol as the first character of
' The DLL name. Some short examples:
' Functions starting with an underscore must be aliased to work properly
openconsole
setprecision 10
DECLARE "!crtdll.dll", strcpy(dest as string,source as string),string
DECLARE "!crtdll.dll", strdate ALIAS _strdate(format as string),string
DECLARE "!crtdll.dll", atof(num as string),double

DEF source,dest,date as STRING
source = "a string to copy"
strcpy(dest,source)
PRINT "Copied string = ",dest
strdate(date)
PRINT "Todays Date is ",date
PRINT atof("1.23e-5")
do:until inkey$ <> ""
closeconsole


One thing the original IBasic couldn't handle was a double/float return from a CDECL DLL function.  Creative BASIC handles them fine.

Paul.
Ionic Wind Support Team

pistol350

LOL!
I go for Creative Basic and I know how much Graham loves that language  :)
I really like the idea of the revival of Ibasic Std but improved and again with full support  :-*
I hope that this will be a call to all the former pixia Users who vanished .

Cheers!
Peter B.
Regards,

Peter B.

GWS

It's a breath of coding freedom again .. and fun ..  :)

Already there are so many examples of 'Creativity' based on the straightforward tools that the new Creative Basic provides.

best wishes, :)

Graham
Tomorrow may be too late ..