DIM FUNCTION Foo$(a$)
TYPE MyType
DYNAMIC A$[]
DYNAMIC FN[] AS Foo_TYPE
B AS INTEGER
END TYPE
DIM mt AS MyType
REDIM mt.A$[2]
REDIM mt.FN[3]
mt.A$[0] = "Hello "
mt.A$[1] = "World"
mt.FN[0] = LCASE$
mt.FN[1] = MCASE$
mt.FN[2] = UCASE$
PRINT mt.FN$[0](mt.A$[0]), mt.FN$[0](mt.A$[1])
PRINT mt.FN$[1](mt.A$[0]), mt.FN$[1](mt.A$[1])
PRINT mt.FN$[2](mt.A$[0]), mt.FN$[2](mt.A$[1])
CLang errors
snip.cpp:380:12: error: assigning to 'Foo_TYPE' (aka 'char *(*)(char *)') from incompatible type 'char *(LPCTSTR)'
(aka 'char *(const char *)'): type mismatch at 1st parameter ('char *' vs 'LPCTSTR' (aka 'const char *'))
mt.FN[0]=lcase;
^~~~~
snip.cpp:381:12: error: assigning to 'Foo_TYPE' (aka 'char *(*)(char *)') from incompatible type 'char *(LPCTSTR)'
(aka 'char *(const char *)'): type mismatch at 1st parameter ('char *' vs 'LPCTSTR' (aka 'const char *'))
mt.FN[1]=mcase;
^~~~~
snip.cpp:382:12: error: assigning to 'Foo_TYPE' (aka 'char *(*)(char *)') from incompatible type 'char *(LPCTSTR)'
(aka 'char *(const char *)'): type mismatch at 1st parameter ('char *' vs 'LPCTSTR' (aka 'const char *'))
mt.FN[2]=ucase;
^~~~~
3 errors generated.
MSVC errors
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.9.0-pre.2.0
** Copyright (c) 2020 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
Compiling "snip.cpp"..........
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29617 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
snip.cpp
snip.cpp(380): error C2440: '=': cannot convert from 'char *(__cdecl *)(LPCTSTR)' to 'Foo_TYPE'
snip.cpp(380): note: This conversion requires a reinterpret_cast, a C-style cast or function-style cast
snip.cpp(381): error C2440: '=': cannot convert from 'char *(__cdecl *)(LPCTSTR)' to 'Foo_TYPE'
snip.cpp(381): note: This conversion requires a reinterpret_cast, a C-style cast or function-style cast
snip.cpp(382): error C2440: '=': cannot convert from 'char *(__cdecl *)(LPCTSTR)' to 'Foo_TYPE'
snip.cpp(382): note: This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Linking ................
Microsoft (R) Incremental Linker Version 14.28.29617.0
Copyright (C) Microsoft Corporation. All rights reserved.
LINK : fatal error LNK1181: cannot open input file 'snip.obj'
Finished!
Pelles C errors
Setting 64-bit environment for Pelles C...
Compiling "snip.c"..........
snip.c(376): warning #2145: Using incompatible types 'char * __cdecl (*)(const char *)' and 'Foo_TYPE (aka char * __cdecl (*)(char *))'.
snip.c(377): warning #2145: Using incompatible types 'char * __cdecl (*)(const char *)' and 'Foo_TYPE (aka char * __cdecl (*)(char *))'.
snip.c(378): warning #2145: Using incompatible types 'char * __cdecl (*)(const char *)' and 'Foo_TYPE (aka char * __cdecl (*)(char *))'.
snip.c(214): warning #2135: Static 'Foo' is not referenced.
Linking ................
Finished!
[/code]