To Colin -

3 (4) pieces of advise :

1) Calling convention: Use STDCALL _not_ CDECL. MapBasic only supports
STDCALL. I may seem to work if you use CDECL but you'll leave bits of data
on the stack for each call to the dll functions. 
2) If you can, make your dialog modal and free all memory "inside" your dll
based function before you return to MapBasic
3) If you have to react to DLL_PROCESS_*** messages, look at the following
article from Microsoft:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/bas
e/dllmain.asp If you are using Borland C++ Builder search Google for "int
WINAPI DllEntryPoint"

..... 4) If you possibly can .... use Delphi to make dlls for MapBasic.
There is some very good examples of MapBasic/delphi integration floating
around on the net, ex. Robert Edwards MapBasic/Delphi integration examples
at: ftp://members.aol.com/MTFTPSite/dpmbdlls.exe. You can download a free
Delphi environment from www.borland.com

regards 
Bo Thomsen
GeoConsult I/S
Denmark 

(Who learned the hard way when to use C and _not_ to use C together with
MapBasic)
 
-----Oprindelig meddelelse-----
Fra: Colin Henderson [mailto:[EMAIL PROTECTED]]
Sendt: 4. februar 2003 15:03
Til: MI-L List (E-mail)
Emne: MI-L MI-L: Clean way of closing a C DLL


All,

I have a dll written in C which contains some dialogs.  When I select a map
object my dialog is called from the dll to display some info related to the
dialog.  All works fine, except when I close my mbx MapInfo crashes - this
behaviour only occurs when using my dll which leads me to believe that my
dll is not freeing up.

Does anyone know of a code snippet that will clear out the dll? Should I be
performing some operation in the DLL_PROCESS_DETACH message?

--------------------------------
Colin Henderson
Senior Developer
Ordnance Survey
Tel: (0)2380 79 2034
--------------------------------




If you have received this email in error, please delete it immediately and
notify the sender. This email may contain confidential information and if
you are not the intended recipient, you must not copy, distribute or rely on
it.
As email is not a 100% secure communications medium, you accept that there
are risks in communicating by email by doing so. We advise you to check that
emails and attachments are virus-free before opening them. No contracts can
be entered into on our behalf by email. Opinions expressed in this email are
not necessarily endorsed by us unless otherwise specifically stated. We
reserve the right to read and monitor any email or attachment entering or
leaving our systems without prior notice.
Ordnance Survey
Romsey Road
Southampton SO16 4GU
Tel: 023 8079 2000
http://www.ordnancesurvey.co.uk


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 5358

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 5371

Reply via email to