Board index » cppbuilder » Using VCL in a DLL
Matt Neimeyer
CBuilder Developer |
Using VCL in a DLL2005-12-02 04:19:52 AM cppbuilder56 I apologize if what I need is "obvious" but every time I search for this anywhere, I find only references about using already existing DLL's in a new Builder project and not the other way around. What I'm trying to do is build a utility DLL for use with a legacy Visual FoxPro 6 application that the client doesn't want to upgrade right now so as to add a few stop-gap features. Which means I'm trying to do this with minimal effort on my part. When I used the BCB5 Pro DLL Wizard (Selecting C++ Source, Use VCL and not VC++ Style) I basically ended up with this (removed some comments and whitespace)... //-------------------------------------------------------------- #include <vcl.h> #include <windows.h> #include "Unit2.h" #pragma hdrstop #pragma argsused BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, LPVOID lpvReserved) { return 1; } //-------------------------------------------------------------- I then added a new form to the project and dropped some non-visual components on it (NMHTTP and NMSMTP from the FastNet tab). Then I added an include for the unit2.h to the unit1.cpp Using this version of the function I can get back what I put in. extern "C" _declspec(dllexport) char* getweb(char* Url) { return Url; } Using this version I get an error from FoxPro when I call the function extern "C" _declspec(dllexport) char* getweb(char* Url) { Form2->NMHTTP1->Get(Url); return Form2->NMHTTP1->Body.c_str(); } I /assume/ that this is because I'm not instantiating the form that contains the non-visual component. Not that I want to instantiate the form for this function (I will for other functions which is a different issue...) Any pointers on how I can get this done would be GREATLY appreciated! Thanks in advance! Matt Neimeyer |