Type-Declaration Characters

Type-Declaration Characters

I’m having problems passing variables to an API function. I always receive a Type mismatch error. I reproduced the situation in Visual Basic and found that if I used type-declaration characters to declare the problem variables, they were compatible with the API function. So now, I have it working in Visual Basic, but not yet in Delphi. Are there type-declaration characters or something equivalent in Delphi? Here is a sample of my VB code:

'The following vars must be declared with a 'type-declaration character, 'else Type mismatch '(why?...I havea hunch that using 'As String''assigns a NULL value, where 'var$' actually 'assigns an emptystring "")Dim desc$, dt$, con$, fn$, own$, v6$ 'stringsDim fo%, mt% 'integers

The problem doesn’t lie in the API itself, but in Delphi’s wrapper of the API call. What you need to do in addition to looking at the online help is to look at the Delphi source code for the call. Once you see how the call is prototyped, you can pass the appropriate types to it. It takes a lot of the guesswork out of calling API functions.

See also  How HealthStream Learning Center Supports Healthcare Education and Compliance

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist