I'm looking to create a COM object in a VBA macro and then pass it to a Delphi DLL (D2009). What should my procedure declaration in Delphi look like?
Background: I'm expecting (hoping) the VBA macro to: create the COM object, invoke the Delphi DLL, pass the COM object to the Delphi DLL procedure, stay alive until the Delphi DLL closes itself (the DLL will have embedded forms for the user to interact with).
I think I'll need to create a callback function to let the VBA macro know that I'm done so it can tidy up but I'll work on that independently of this question.
UPDATE More specifically: What should the exported function declaration be for the Delphi DLL.
you have to pass ADO Connection interface link
_Connection
to delphi procedure then create TADOConnection instance and replace ConnectionObject with new interface linkit is better to use
stdcall
calling convention. usingexport
keywordsetConnection
proc is available from uotside withSetDBConnection
name , so you canLoadLibrary
andgetProcAddress
to find its entry point (really I don't know VBA so I can't say how to load library using it)