c# - Build TagLib# DLL from source and make it COM Visible to PHP -


hello want scan audio-video files , store metadata in database using php. found command-line wrapper uses taglib.dll compiled banshee developpers job. it's works fine limited functions implemented. want access directly dll methods via php.

in php have function (dotnet) allows me instantiate class .net assembly , call methods , access properties :

/*$obj = new dotnet("assembly", "classname");*/    $stack = new dotnet("mscorlib", "system.collections.stack"); $stack->push(".net"); $stack->push("hello "); echo $stack->pop() . $stack->pop();  //returns string(10) "hello .net"; 

here is the taglib# project sources in github

i saw many questions relatives php-dll-com , there recommendations :

  • make dll comvisible;
  • register dll regsvr32;
  • use module definition file similar to

;

;  description     "simple com object"  exports                 dllgetclassobject       private                 dllcanunloadnow         private                 dllregisterserver       private                 dllunregisterserver     private 

my question : how can build dll , use method via php ?

my config :

  • os

    windows server 2012 r2 standard edition i586

  • apache :

    apache/2.2.21 (win32) dav/2 php/5.4.42 mod_ssl/2.2.21 openssl/0.9.8r

  • php

    php version : 5.4.42
    arch : x86
    compiler : msvc9 (visual c++ 2008)
    com support : enabled
    dcom support : disabled
    .net support enabled

  • microsoft visual studio 2013

give following steps try:

  1. download taglib source code github
  2. remove applicationicon tag .csproj file , open .sln in visual studio
  3. unload test project (you don't need build this)
  4. right-click on taglib-sharp project --> properties --> build --> enable 'register com interop'. clear conditional compilation symbols textbox don't have bother downloading sharpziplib now.
  5. observe #1: in project properties --> application --> assembly information --> 'make assembly com visible' checked
  6. observe #2: in project properties --> application --> target framework set 3.5 (make sure leave that)
  7. build project (f6)
  8. read contents of output window see warnings

now have src\taglib-sharp.dll need register global assembly cache in order dotnet class find it. see php dotnet hell details if not familiar this.

if good, can copy of sharpziplib, , reenter have_sharpziplib conditional compilation symbol --> rebuild --> redeploy gac --> , happy man! :)


Comments