RE: XstCall

22 views
Skip to first unread message

Geoffrey Gaudi

unread,
Nov 22, 2025, 8:57:24 PM (7 days ago) Nov 22
to xblite
Hello Everyone:

          Is it possible to pass a float (SINGLE) to the array parameters
   of XstCall? A string is passed as &"My String"? 

   So the code would be:

 Function Prototype: SINGLE AddNums(SINGLE, SINGLE, STRING)
 'prints string and returns a + b

 'some functions in the Win32 and DirectX api use floats

    a! = 2.1
b! = 3.4

DIM args[2] '0 IS AN ENTRY
args[0] = &a! 'does not work '@a! gives me a type error???
args[1] = &b! 'does not work
args[2] = &"Hello Message" 'works
        'result returns 0
result! = XstCall ("AddNums", "mdll.dll", @args[]) 'does not work

        DIM args![2] is also not accepted in the function call, type error.

PRINT "RESULT:= " + STRING(result!)

    Please let me know if there is a solution.

   Thank you,

Guy LONNE

unread,
Nov 23, 2025, 12:47:56 PM (6 days ago) Nov 23
to xblite

Hello Geoffray.

Welcome to the list!

You won't be able to use XstCall to make your API call, as XstCall uses a simplified calling protocol and your AdNums API is too complex to be handled by XstCall.

XstCall is a workaround when you don't have a function prototype or (as happened to me once) when the available prototype is incorrectly constructed. Therefore, only consider XstCall as a last resort.

In XBLite, it's crucial to add the correct prototype and then strictly adhere to the parameter list and their respective data types. The XBLite compiler only uses the provided prototype to validate later the syntax of the call in your program.

So, forget about XstCall for the AdNums API.

Good luck with your exploration and learning of XBLite!

Bye! Guy

David Szafranski

unread,
Nov 25, 2025, 11:46:38 PM (4 days ago) Nov 25
to xblite on googlegroups
 Geoffery,

You might be able call your mdll.dll library functions using computed function calls.
Search for computed function calls in the xblite help manual.
Here is an example:

FUNCTION SINGLE AddNums (SINGLE v0, SINGLE v1, XLONG v2)
   
    STATIC FUNCADDR SINGLE  f(SINGLE, SINGLE, XLONG)

    hMod = LoadLibraryA (&"mdll.dll")
    IFZ f THEN f = GetProcAddress (hMod, &"AddNums")

    ' don't forget to release hMod
    FreeLibrary (hMod)

    ' call the function
    RETURN @f(v0, v1, v2)
END FUNCTION

Hope this helps.

David



Geoffrey Gaudi wrote:
Hello Everyone:

          Is it possible to pass a float (SINGLE) to the array parameters
   of XstCall? A string is passed as &"My String"? 

   So the code would be:

 Function Prototype: SINGLE AddNums(SINGLE, SINGLE, STRING)
 'prints string and returns a + b

 'some functions in the Win32 and DirectX api use floats

    a! = 2.1
b! = 3.4

DIM args[2] '0 IS AN ENTRY
args[0] = &a! 'does not work '@a! gives me a type error???
args[1] = &b! 'does not work
args[2] = &"Hello Message" 'works
        'result returns 0
result! = XstCall ("AddNums", "mdll.dll", @args[]) 'does not work

        DIM args![2] is also not accepted in the function call, type error.

PRINT "RESULT:= " + STRING(result!)

    Please let me know if there is a solution.

   Thank you,

--
You received this message because you are subscribed to the Google Groups "xblite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xblite+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/xblite/51922095-8752-4469-be0f-1a37e6527c80n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages