I am having a hard time creating and accessing a data extension. I have followed the documentation, created my data dictionary, parsed this with the ddbuild.exe and added the two header files to my plugin code, created both library files, but am unable to access any of the data extensions from a stand alone program. I have even tried using the sample plug ins given with the API, to try and get a starting point. The function mgNewRec() returns NULL. It does not appear that mgInit is recognizing my plugin. I tried putting the plugin dll in the various locations described in the documentation. The only plugin that seems to be loading is the fltdata.dll. We are experimenting with the 2.5 API, and about to be subcontracted by a client that has the 3.4 API. The documentations seem to indicate that this should "just work" by dynamically loading the library for the plugin. Any and all help would be greatly appreciated.
// Test.cpp : Defines the entry point for the console application.
int main(int argc, char* argv)
mgrec* db = mgNewDb("Test.flt");
mgrec* mine = mgNewRec(myBead1);
mgrec* poly = mgNewRec(fltPolygon);
if (poly == MG_NULL)
printf("This didn't work either");
if (mine == MG_NULL)
printf("No data was found!\n");
Your extension DLL is loaded in your app when you call mgInit. The first thing to do is to make sure mgInit is "finding" your DLL at runtime. You say
I tried putting the plugin dll in the various locations described in the documentation.
I presume you set the MGPLUGINDIR environment variable to the folder that contains your extension DLL (this is required). If you do this, mgInit will search for DLLs it finds here and call LoadLibrary on each to load your extension DLL.
Until you can get that part working and verify that your plugin is being found ok, you won't be able to access your data.
One other thing in the sample app code you posted... you should call mgInit with the args from your main function (not NULL, NULL). See the sample applications to see how this is normally done.