Are you compiling both the PHP extension and the library with the same
compiler and linker settings, i.e. both of them need to have multithreaded
DLL settings, etc. It might also be a case of #including the same file
multiple times and getting the symbols defined multiple times accidently.

There is also an option in the linker to force linking even if there are
symbols defined multiple times. I believe the first found instance of the
symbol will be used and the others ignored. MSFT says this can cause
unexpected results, which is probably true, but I've had to do it a few
times and haven't noticed anything weird happening.

J


Dave Viner wrote:

> Hi,
> I'm trying to write a simple PHP extension that will wrap a C++ class.  I
> have a test C++ program which exercises the class and works properly.  I
> am trying to make the PHP extension code work, but I keep running into
> this error in VC++:
> 
> DataStore.lib(FileSystemDataStore.obj) : error LNK2005: "void __cdecl
> operator delete(void *,void *)" (??3@YAXPAX0@Z) already defined in
> DataStore.obj
> 
> This occurs only if I instantiate an object of my class (named
> FileSystemDataStore).
> #if 1
>     FileSystemDataStore *fsds = new FileSystemDataStore(fs_args);
> #endif
> Including this code causes the linkage error, and #if 0 this block will
> compile and link fine.  I suspect the php glue code since my C++ test
> program compiles and links fine against the same .lib.
> 
> Has anyone seen this error or have a suggestion for how to fix it?
> 
> Thanks
> dave
> 
> P.S - I'm not sure if this is the correct list to post this question on,
> so please let me know if I should repost it elsewhere.


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to