Original Post
hello all. allow me to preface this post by saying that i am by no means an ATL/COM expert -- not even close. i''m in a situation where i have to figure this out as i go. i have some good reference material, but i''m stuck. hopefully one of you gurus can help me out. here goes...
i''m in the process of wrapping an existing C API in COM server that will be called from ASP pages. there is one interface, ITask, exposing an Execute() method, which is the primary workhorse. from inside this Execute() function, i make calls to the afore-mentioned API. one of these API functions expects a function pointer as a parameter, like so:
hr = p4SetOutputFunction (sessionHandle, //long processReportData) //function pointerthe p4SetOutputFunction() uses the function pointer param to set up a callback to handle each line of report output. for instance, if the API were used in a Windows console app, the processReportData() function would print each line of report output to stdout. now here is my problem. p4SetOutputFunction() and processReportData() are now contained in my COM Interface. a function pointer to processReportData() in C++ now also passes a hidden pointer to this (the CTask object -- my implementation of the ITask interface). but i can''t modify the arg list for p4SetOutputFunction(), because it''s part of an existing API. so i''m stuck trying to figure out how to pass the function pointer. sorry for the long-winded explanation. if it''s still clear as mud, please let me know and i''ll try to explain a little better. i''m doing the best i can at explaining with my limited knowledge. i''ll be grateful for any suggestions. thanks!