Link to home
Start Free TrialLog in
Avatar of dagan
dagan

asked on

OLE - early binding without library file ?

Hi all,
1. I am developing an MFC application and need to use an OLE Automation Server, that was written using OWL (Borland C++). The problem is that I do not have any .tlb, .dll, .odl files, or something like that. All I got is the .exe file of the server.
Can I still use it with early binding using MFC wizard?
I am quite a beginner in this area, so excuse me if I use incorrect keywords or mix-up something.
2. Assuming I will get the C++ sources of the server, how do I export a type-library or some equivalent to be used later with the MFC (for example by "adding new class from a type library" in the Class Wizard) ?

thanks,
    Dagan
Avatar of chensu
chensu
Flag of Canada image

Simply use CoCreateInstance to get the interfaces and call the methods.
Avatar of dagan
dagan

ASKER

Thanks, but if I get it right CoCreateInstance() does not allow early binding. I want to create my own wrapping class to hide all the calls to the OLE server (the InvokeHelper(..) calls).
Actually I found out how to create a type library from Borland (you simply compile it with -typelib flag), but it caused some compatibility problems.
That's because the MFC Wizard (I think) didn't recognize all var types defined in the server (especially the BYTE) and did not create a wrapping method to many of the functions.
So it's basically a Borland vs MFC question:

How should I let the MFC Wizard add a class from a type-library (*.olb) defined in Borland C, while using ALL var types?

(was that clear?)
Using IDispatch is late binding. Using other interfaces directly is early binding. InvokeHelper uses IDispatch.
Avatar of dagan

ASKER

ehmm...
I guess I should learn a little more about that subject. Anyway I am over that. What leaves me with the question of creating a .olb file from Borland C, which will be fully understood by MFC Wizard.
Meanwhile I'll do some job by hand using Cut&Paste technologies to complete the missing funcs...
Avatar of dagan

ASKER

chensu, please propose an answer...
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial