[DGD]Calling CPP Functions from an Extension

Wim van der Vegt wvd_vegt at knoware.nl
Mon Jan 22 11:13:20 CET 2001


Hi,

Perhaps have a look at how felix updates the UI (which is a cpp function) by
writing an c function that can be called from inside the lib and have the c
function call the cpp function.

--------------
Wim van der Vegt.

> -----Original Message-----
> From: dgd-admin at list.imaginary.com
> [mailto:dgd-admin at list.imaginary.com]On Behalf Of Michael J. Bacon
> Sent: woensdag 17 januari 2001 15:37
> To: dgd at list.imaginary.com
> Subject: [DGD]Calling CPP Functions from an Extension
>
>
>
> 	Hello all!  My apologies if this has been asked and
> answered in the past I
> am relatively new to the list and still trying to figure out the
> best way to
> go through the archive files in a logical manner.
>
> 	Anyway, I've been playing around with dgd1.2's extension
> capabilities.
> Very neat I must say.  For convoluted reasons I find myself
> needing to call
> C++ functions from an extension.  I realize I will be unable to directly
> access class objects or advanced C++ constructs from an extension, but I
> have devised a few functions which, in theory, should act as a
> layer between
> the C++ objects and methods and the procedural C calls any extension would
> make.  I wrote a simple extension to test this theory, and I'm glad I did,
> because I can't get things to link.
>
> 	I am trying to do this on WinNT using Visual C++ 6.0.  I am
> trying to link
> in a very simple CPP file which at the moment does nothing except
> declare a
> string variable...  It looks like this:
>
> ------
> #define TESTHR(x) if FAILED(x) _com_issue_error(hr)
>
> // Function declarations
> int OpenX(void);
>
> ///////////////////////////////////////////////////////////
> //                                                       //
> //               OpenX Function                          //
> //                                                       //
> ///////////////////////////////////////////////////////////
>
> int OpenX(void)
> {
>
>     _bstr_t strCnn("Provider=sqloledb;Data Source=MyServer;"
>         "Initial Catalog=pubs;User Id=sa;Password=;");
>
>
> 	return 0;
>
> }
> ------
>
> Compiles fine, but when I link I get the following errors:
>
> Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
> Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
>
> No configuration specified.  Defaulting to windgd - Win32 Debug.
>         link.exe @C:\WINDOWS\TEMP\nma00163.
> nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator
> new(unsigned i
> nt)" (??2 at YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)
> nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator
> delete(void
> *)"
> (??3 at YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)
> .\Debug/dgd.exe : fatal error LNK1169: one or more multiply
> defined symbols
> foun
> d
> NMAKE : fatal error U1077:
> 'D:\PROGRA~1\MICROS~1\VC98\BIN\link.exe' : return
> cod
> e '0x491'
> Stop.
>
>
> 	Any ideas what I am doing wrong?  I haven't modified
> windgd.mak at all
> except to add the cpp file to the dependency and to link it in...
>
> 	Thanks in advance for any advice...
>
>
> Michael.
>
>
> List config page:  http://list.imaginary.com/mailman/listinfo/dgd


List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list