Address(Procedure Overloading) - Address Parameter ambiguous - How can I specify which procedure?

So when using address(Procedurename) where procedurename is an overloaded procedure, ie same name different parameter prototypes, how can I specify which procedure to use as the Address parameter?


I’ve just realised what Carl’s reply is, its not a reply its my post edited, for US grammar perhaps?

You don’t say why you need to do this?

I don’t know a way to do this with Clarion ADDRESS(). Maybe a TYPE procedure would help. I would look at how it’s done in C++ for some ideas.

If Procedure was in an external DLL then use GetProcAddress( ). You’ll need the Mangled name for the desired parameter list.

If Procedure was internal mark it Exported then use GetProcAddress( ).

1 Like

For a Class method. So I have a class with some overloaded (procedure) methods, and its actually linked to the problem I’ve been working on here How can I access the raw stack data? MS callback proc prototype changes when asm starts popping the stack - questions - ClarionHub

So I have two win32 api’s defined in the class, one prototyped to use *cstring and the other prototype to use a simple long. Both have the same name(‘win32api name’).

My class methods are prototyped to follow suit ie
EnumerateTypesA Procedure (*cstring ptype)
EnumerateTypesA Procedure(Long pType)

And its these above methods that has the code to pass the address of one of the below callback methods to the win32 api which calls the callback class method, but it cant work out from the class method its in, what callback class method to call. I tried adding the prototype to help the function but it didnt like that, which would seem to be the easiest way to select the correct overloaded callback class procedure method.

EnumerateResourceTypeProcA (*cstring ptype) !callback
EnumerateResourceTypeProcA (Long ptype) !callback
I’ve simplied the prototype to make the point obvious.

However as you see from my other post, the parameter handling is not straight forward with these enumresource callbacks.

I’ll bear this in mind thanks.

Those 2 EnumerateResourceTypeProcA() API callback functions do Not need to have the Same Name and be overloaded. Rename them Proc1 and Proc2 and be done.

And as you’ve been told an API callback cannot be a Class Method.

Thats what I’ve had to do for now, its the only.

I beg to differ, what you have to do is create a reference to the class in the class method which is the callback and then refer to it by its new name, and not self.method or

Note I’ve changed lpParam from a long to the ClassName in the prototype to give me access to everything in the class.

ClassName.EnumResTypeCallBack Procedure(long lp01, long lp02, long lp03, ClassName lpParam, long pType, long phModule)
MyCallbackClassName  &ClassName

I had even tried using Bind in the hope it would work like the C++ Bind function, but the Clarion Bind doesnt handle classes., so for now I’m exploiting the compiler. :grinning: