Compiling DLL for external tutorial

2000-04-18 Thread Ken Simons

I am trying to complete the external tutorial for MetaCard on Windows. 
I have built the DLL using the external code provided with MetaCard, and
it seems to compile fine.  When I open the external tutorial stack, the
external.dll gets attached (Windows no longer lets me delete the file or
change its name because it is in use).  But, MetaCard isn't recognizing
any of the XCMDs.  For example, clicking on the "sprintf" button yields
the error message "can't find handler".  Clicking on the "xatan2" button
yields the error message "error in function handler", presumably for the
same reason.  I suspect the list of XCMDs/XFCNs in the DLL is somehow
not being registered properly.

I am building the DLL in CodeWarrior (ver. 3.2), compiling the source
files XCmdGlue.c and external.c.  I notice in the "external.def" file
that comes with MetaCard that there is something saying
EXPORTS
getXtable
and I have not taken this into account (I'm not sure how I would in
CodeWarrior; the .def file is for Visual C++).  I have not touched
CodeWarrior's default (for a DLL project) settings for memory usage
(base address, stack and heap sizes -- anyway I'm not sure whether they
are relevant for DLLs).  Nor have I changed any link options (thus I
have not checked boxes to generate link map, SYM file, or CV info,
whatever those do).

There must be some obvious solution to this, but I'm afraid I'm new at
this  Can anyone provide insights?  Or maybe someone can email me
directly with a CodeWarrior project version of the external, for 
an example that works as a starting point?

Thanks much in advance!

Ken

Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




How to create large XCMD / DLL with callbacks

2000-02-28 Thread Ken Simons

I need to create an XCMD and DLL with several tricky characteristics. 
While I have created Macintosh XCMDs before, I am not sure how to deal
with this set of characteristics.  Also I have not dealt with DLLs for
PCs so I am unaware of issues that may arise.  Any insights or
references to code that does the job would be much appreciated.  

1. The XCMD / DLL must be substantially larger than 32K.  So, at least
for Macintosh, I have to create an XCMD that loads the larger block of
code into memory and then calls it.  Also, perhaps it is best to leave
the loaded code resident in memory until MetaCard quits (or my MetaCard
stack closes), because the XCMD / DLL will be called repeatedly.
2. The XCMD / DLL must allocate large amounts of memory (several MB), to
be maintained even when the XCMD / DLL is not in use, and de-allocated
when MetaCard quits.  I have done this previously on the Mac, but I
haven't learned how to do this on PCs.
3. The XCMD / DLL must set global variables in MetaCard, and ideally
could make other callbacks to MetaCard.

CodeWarrior comes with some sample projects that discuss issues 1 and 3,
but they take some work to understand (indeed no sample project
incorporates both characteristics 1 and 3) and to be honest I haven't
understood yet.  I was thinking of programming in CodeWarrior C (I have
version 3.2), though I could switch to different software and/or
programming language if that would help.

If anyone has a template or sample code, ideally with at least
characteristics 1 and 3, you could be my savior.

Thanks in advance,
Ken

This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm