Page 2 of 2
Here is my .DEF file
Posted: Tue May 23, 2006 12:17 am
by jemmyell
Hi again,
Here is the .DEF file I made to generate the .LIB from
-James
oops....
Posted: Tue May 23, 2006 12:21 am
by jemmyell
sorry, my attachment did not go. here it is:
LIBRARY "SheetCAM"
EXPORTS
scAddMainMenu
scAddMenu
scIsProcessing
scLoadDrawing
scLoadJob
scRunPost
-James
the LINK /DUMP options DOES definitely see all your exports from SheetCAM BTW
-James
Got my DLL to link, but the news is not good
Posted: Tue May 23, 2006 2:24 am
by jemmyell
Hi Les,
here is my .DEF file modified to add silent function signature junk that Microsoft is putting there. It allows my DLL to link, BUT sheetCAM cannot use it. I am attaching a ZIP file with the .DEF and the DLL for you.
I am afraid that MS deliberately is making binary linkage with borland tools (and probably others) not work.
-James
Posted: Tue May 23, 2006 4:34 am
by jemmyell
Hi Les,
Just to give you a taste of my 'soft' linkage I was developing:
This is what the SheetCAM side would look like:
------------------------------------------------------------------------------------
#define ID_LOADJOB 0x01
void CALLBACK LoadJob(char *);
WORD numInterface;
typedef struct {
WORD *SCInterfaceID;
FARPROC *SCInterface;
} PLUGIN_DATA;
PLUGIN_DATA SCData;
HINSTANCE hPlugin = NULL;
typedef VOID (CALLBACK *PLUGINSTARTUP)(WORD, PLUGIN_DATA *);
typedef VOID (CALLBACK *PLUGINSHUTDOWN)();
PLUGINSTARTUP PluginStartup = NULL;
PLUGINSHUTDOWN PluginShutdown = NULL;
// Build Callback / capabilities table
numInterface = 1;
SCData.SCInterfaceID = (WORD *)calloc(numInterface, sizeof(WORD));
SCData.SCInterface = (FARPROC *)calloc(numInterface, sizeof(FARPROC));
SCData.SCInterfaceID[0] = ID_LOADJOB;
SCData.SCInterface[0] = (FARPROC)(LoadJob);
// Load the plugin DLL
hPlugin = LoadLibrary("SheetCAMPlugin.dll");
if (NULL != hPlugin) {
// Call PluginStartup()
PluginStartup = (PLUGINSTARTUP)GetProcAddress(hPlugin,"PluginStartup");
if (NULL != PluginStartup) {
(*PluginStartup)(numInterface, &SCData);
}
}
-----------------------------------------------------------------------------------
And this is what the startup in the DLL would look like:
STDAPI PluginStartup(WORD numInterface, PLUGIN_DATA *scData)
{
int idx;
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DbgMsg("PluginStartup entry");
// Setup the SheetCAM callback table
pluginTable.SCInterfaceID = (WORD *)calloc(numInterface, sizeof(WORD));
pluginTable.SCInterface = (FARPROC *)calloc(numInterface, sizeof(FARPROC));
for (idx = 0; idx < numInterface; idx++) {
pluginTable.SCInterfaceID[idx] = scData->SCInterfaceID[idx];
pluginTable.SCInterface[idx] = scData->SCInterface[idx];
}
// Start the callback thread
CreateThread(NULL,0L,CallbackThread,&threadData,0,NULL);
// Since we were called, SheetCAM is running
IsRunning = TRUE;
DbgMsg("PluginStartup exit");
return S_OK;
}
------------------------------------------------------------------------------------
Just my two cents. I hope we can make the hard linkage work, it is simpler.
-James
Hace you considered a SheetCAM plugin API?
Posted: Tue May 23, 2006 4:12 pm
by Les Newell
I downloaded Visual Studio 2005 and did some experiments. VC++ really
insists on name mangling, no matter what you do. In the end I have had
to resort to referencing functions by ordinal. This arrangement will
still make SheetCam backwards compatible with older plugins. Newer
plugins trying to use functions that are not available will load but
when they try to access unavailable functions they will crash. In the
same situation, BCB based plugins (using names) will simply fail to load.
The next release of SheetCam (due out in a few hours) will include an
SDK directory containing both VC++ and BCB demo projects.
Les
Thank you so much
Posted: Tue May 23, 2006 4:31 pm
by jemmyell
Hi Les,
That is good news. I will look forward to this.
-James