Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a C++ DLL to use with FoxPro
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00048334
Message ID:
00050949
Views:
48
Hi Rick,

You may want to try using Microsoft's ATL library for creating COM objects. It's relatively easy to create lightweight COM objects that can be instantiated in VFP. I have recently created a class which I use for doing date conversions. I have found that a simple COM object takes about a sixth of the time it takes to instantiate a native VFP Custom class.
Calling methods and accessing properties is straightforward and the marshalling that is done during automation calls makes it easy to pass strings between VFP and C++.

Darrel

>The other question is what if I have a C++ (instead of C) program, and I want to make a DLL out of it to call from FoxPro. Is it possible? If so, how?
>
>You can't call C++ objects or methods directly from VFP due to the fact that
>C++ mangles names and requires stackframes that VFP can't access.
>
>What this means is that you should write a wrapper around any C++ code that
>handles the class instantiation and calling of methods. This true for any
>API access, really. Only other C++ programs typically can call C++ classes
>directly and even then you have to go through all sorts of girations to
>get the nameing conventions to sync.
>
>+++ Rick ---
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform