Calling DLL functions with structs

Phil (OmnisList) phil at
Fri Aug 18 08:12:36 UTC 2023

Hi Dean,

Basically nothing else but to confirm that CallDLL does not handle 
structures like that....

But also noting that you would of needed the W variant of the call.

For something like this, I'd do an external xcomp...

If that is a consideration, you might consider expanding/looking at the 
Omnis System Info xcomp on GitHub:

Phil Potter
Based in Chester in the UK.

On 18/08/2023 02:49, Dean Leggo wrote:
> Hey everyone
> I am working on a project to convert some Visual Basic code to Omnis 
> and the code block makes a number of DLL calls with structs. But 
> Omnis' [Register 
> DLL]( 
> does not support structs.
> Has anyone passed a struct to a DLL or how can I call the DLL function?
> An example could be 
> [GetDiskSpaceinformationA](
> I want to call it like the code below. This won't work as you cannot 
> declare structs and the types are probably wrong. But this is want I 
> am wanting to do.
> Register DLL ("KERNEL32.DLL","CreateFileA","AC(RRRRRRRRRJJ)")
> Do 
> lrowDiskSpace.$define(int64,int64,int64,int64,int64,int64,int64,int64,int64,int64,int64,char4,char4)
> Calculate lsDirectory as '%localappdata%\Omnis Software'
> Call DLL ("KERNEL32.DLL","CreateFileA",lsDirectory,lrowDiskSpace) 
> Returns lbOK
> Cheers,
> Dean Leggo

More information about the omnisdev-en mailing list