I'm trying to call an external function in a DLL that has been provided to me. It was written in Delphi, but at least apparently declared to use C-style strings and the stdcall calling convention, so it should work.
But when I call it (whether or not I add ";Ansi" to the Alias section of the declaration) I get "Error calling external function %s at line ...".
That "%s" part of the message seems a bit unusual.
I did confirm that I get a different error message if the DLL isn't present. I also get a different error message (that fills in the function name instead of "%s") if I use an incorrect method name in the alias clause.
In case it's helpful, the declaration is like:
Function String Foo(String arg1, string arg2, String arg3) LIBRARY "libname.dll" alias for "FOO"
Yes, the name is capitalized in the DLL, when I look at it with "dumpbin /exports", though I doubt that matters. In case it's helpful, here's the relevant part of that output:
ordinal hint RVA name
1 0 0015C2E8 FOO
(I have changed the names for privacy of the 3rd party.)
Adding REF before the argument definitions also doesn't work, then I get an error about incorrect reference argument.
Any bright ideas? Thanks.