Information générale
Catégorie:
Fonctions Windows API
>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 ---
In addition:
If it's C++, it's better to make it an ActiveX, not a DLL.
If it's C++, but the exported functions are C functions, not objects' methods, you can use extern "C" declaration:
extern "C" DllExport MyFunc()
{bla,bla
}
extern "C" will force the exposed function names to C standard.
That also means that the wrapper can be written in C++ and to be a very simple one (used just to hide the objects).
Vlad
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement