[mapguide-commits] r8811 - in sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi: . Custom

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Nov 5 03:13:35 PST 2015


Author: jng
Date: 2015-11-05 03:13:35 -0800 (Thu, 05 Nov 2015)
New Revision: 8811

Added:
   sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/EntryPoint.cs
   sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/dotnetcore.i
Modified:
   sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/DnxCoreShims.cs
   sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/DotNetCoreApi.vcxproj
Log:
Remove the proxy class that contains the MgInitializeWebTier() method. We've replaced this with our own entry point class, as I suspect some DNX native library tricks will have to be employed before it's safe to call MgInitializeWebTier() proper.

Modified: sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/DnxCoreShims.cs
===================================================================
--- sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/DnxCoreShims.cs	2015-11-05 10:45:59 UTC (rev 8810)
+++ sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/DnxCoreShims.cs	2015-11-05 11:13:35 UTC (rev 8811)
@@ -1,3 +1,20 @@
+//
+//  Copyright (C) 2004-2015 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
 namespace System
 {
     #if DNXCORE50

Added: sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/EntryPoint.cs
===================================================================
--- sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/EntryPoint.cs	                        (rev 0)
+++ sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/EntryPoint.cs	2015-11-05 11:13:35 UTC (rev 8811)
@@ -0,0 +1,35 @@
+//
+//  Copyright (C) 2004-2015 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+namespace OSGeo.MapGuide
+{
+    /// <summary>
+    /// This is the entry point of the MapGuide API
+    /// </summary>
+    public class MapGuideApi
+    {
+        /// <summary>
+        /// Initializes the MapGuide Web Tier APIs. You must call this method before using any other class or method
+        /// in the MapGuide API
+        /// </summary>
+        /// <param name="configFile">The path to the web tier configuration file</param>
+        /// <remarks>Subsequent calls do nothing and return immediately</remarks>
+        public static void MgInitializeWebTier(string configFile) {
+            MapGuideDotNetCoreUnmanagedApiPINVOKE.MgInitializeWebTier(configFile);
+        }
+    }
+}
\ No newline at end of file

Modified: sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/DotNetCoreApi.vcxproj
===================================================================
--- sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/DotNetCoreApi.vcxproj	2015-11-05 10:45:59 UTC (rev 8810)
+++ sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/DotNetCoreApi.vcxproj	2015-11-05 11:13:35 UTC (rev 8811)
@@ -96,9 +96,10 @@
       <Command>del /Q .\Custom\*prop
 del /Q *.cs
 ..\..\..\BuildTools\WebTools\IMake\Win32\IMake.exe ..\MapGuideApi\Constants.xml C# ./Constants.cs
-copy ..\DotNetUnmanagedApi\dotnet.i .\language.i
+copy .\dotnetcore.i .\language.i
 ..\..\..\BuildTools\WebTools\IMake\Win32\IMake.exe ..\MapGuideApi\MapGuideApiGen.xml C#
 ..\..\..\Oem\SwigEx\Win32\swig -c++ -csharp -dllname MapGuideDotNetCoreUnmanagedApid -namespace OSGeo.MapGuide -proxydir .\Custom -baseexception MgException -clsidcode ..\getclassid.code -clsiddata m_cls_id -catchallcode ..\catchall.code -dispose "((MgDisposable*)arg1)->Release()" -rethrow "e->Raise()%3b" -nodefault -noconstants -module MapGuideDotNetCoreUnmanagedApi -o MgApi_wrap.cpp -lib ..\..\..\Oem\SWIGEx\Lib MapGuideApi.i
+del /Q MapGuideDotNetCoreUnmanagedApi.cs
 </Command>
     </PreBuildEvent>
     <ClCompile>
@@ -131,9 +132,10 @@
       <Command>del /Q .\Custom\*prop
 del /Q *.cs
 ..\..\..\BuildTools\WebTools\IMake\Win32\IMake.exe ..\MapGuideApi\Constants.xml C# ./Constants.cs
-copy ..\DotNetUnmanagedApi\dotnet.i .\language.i
+copy .\dotnetcore.i .\language.i
 ..\..\..\BuildTools\WebTools\IMake\Win32\IMake.exe ..\MapGuideApi\MapGuideApiGen.xml C#
 ..\..\..\Oem\SwigEx\Win32\swig -c++ -csharp -dllname MapGuideDotNetCoreUnmanagedApid -namespace OSGeo.MapGuide -proxydir .\Custom -baseexception MgException -clsidcode ..\getclassid.code -clsiddata m_cls_id -catchallcode ..\catchall.code -dispose "((MgDisposable*)arg1)->Release()" -rethrow "e->Raise()%3b" -nodefault -noconstants -module MapGuideDotNetCoreUnmanagedApi -o MgApi_wrap.cpp -lib ..\..\..\Oem\SWIGEx\Lib MapGuideApi.i
+del /Q MapGuideDotNetCoreUnmanagedApi.cs
 </Command>
     </PreBuildEvent>
     <ClCompile>
@@ -166,9 +168,10 @@
       <Command>del /Q .\Custom\*prop
 del /Q *.cs
 ..\..\..\BuildTools\WebTools\IMake\Win32\IMake.exe ..\MapGuideApi\Constants.xml C# ./Constants.cs
-copy ..\DotNetUnmanagedApi\dotnet.i .\language.i
+copy .\dotnetcore.i .\language.i
 ..\..\..\BuildTools\WebTools\IMake\Win32\IMake.exe ..\MapGuideApi\MapGuideApiGen.xml C#
 ..\..\..\Oem\SwigEx\Win32\swig -c++ -csharp -dllname MapGuideDotNetCoreUnmanagedApi -namespace OSGeo.MapGuide -proxydir .\Custom -baseexception MgException -clsidcode ..\getclassid.code -clsiddata m_cls_id -catchallcode ..\catchall.code -dispose "((MgDisposable*)arg1)->Release()" -rethrow "e->Raise()%3b" -nodefault -noconstants -module MapGuideDotNetCoreUnmanagedApi -o MgApi_wrap.cpp -lib ..\..\..\Oem\SWIGEx\Lib MapGuideApi.i
+del /Q MapGuideDotNetCoreUnmanagedApi.cs
 </Command>
     </PreBuildEvent>
     <ClCompile>
@@ -202,9 +205,10 @@
       <Command>del /Q .\Custom\*prop
 del /Q *.cs
 ..\..\..\BuildTools\WebTools\IMake\Win32\IMake.exe ..\MapGuideApi\Constants.xml C# ./Constants.cs
-copy ..\DotNetUnmanagedApi\dotnet.i .\language.i
+copy .\dotnetcore.i .\language.i
 ..\..\..\BuildTools\WebTools\IMake\Win32\IMake.exe ..\MapGuideApi\MapGuideApiGen.xml C#
 ..\..\..\Oem\SwigEx\Win32\swig -c++ -csharp -dllname MapGuideDotNetCoreUnmanagedApi -namespace OSGeo.MapGuide -proxydir .\Custom -baseexception MgException -clsidcode ..\getclassid.code -clsiddata m_cls_id -catchallcode ..\catchall.code -dispose "((MgDisposable*)arg1)->Release()" -rethrow "e->Raise()%3b" -nodefault -noconstants -module MapGuideDotNetCoreUnmanagedApi -o MgApi_wrap.cpp -lib ..\..\..\Oem\SWIGEx\Lib MapGuideApi.i
+del /Q MapGuideDotNetCoreUnmanagedApi.cs
 </Command>
     </PreBuildEvent>
     <ClCompile>

Added: sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/dotnetcore.i
===================================================================
--- sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/dotnetcore.i	                        (rev 0)
+++ sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/dotnetcore.i	2015-11-05 11:13:35 UTC (rev 8811)
@@ -0,0 +1,58 @@
+//
+//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+///////////////////////////////////////////////////////////
+// STRINGPARAM "in" typemap
+// Marshal a C++ style string to a wstring
+// Allocate temporary memory only when required, otherwise
+// use a buffer on the stack
+//
+%typemap(in) STRINGPARAM
+{
+    $1 = (STRINGPARAM) $input;
+}
+
+///////////////////////////////////////////////////////////
+// STRING "out" typemap
+// Marshal a string returned by C++ to CSharp
+//
+%typemap(out) STRING
+{
+    $result = SWIG_csharp_string_callback((int)(result.length()+1)*sizeof(wchar_t));
+    wcscpy((wchar_t*)$result, result.c_str());
+}
+
+///////////////////////////////////////////////////////////
+// BYTE_ARRAY_OUT "cstype" typemap
+// Type substitution in .NET and proxy code
+//
+%typemap(cstype) BYTE_ARRAY_OUT "Byte[]"
+%typemap(imtype) BYTE_ARRAY_OUT "Byte[]"
+%typemap(ctype)  BYTE_ARRAY_OUT "unsigned char*"
+
+///////////////////////////////////////////////////////////
+// BYTE_ARRAY_IN "cstype" typemap
+// Type substitution in .NET and proxy code
+//
+%typemap(cstype) BYTE_ARRAY_IN "Byte[]"
+%typemap(imtype) BYTE_ARRAY_IN "Byte[]"
+%typemap(ctype)  BYTE_ARRAY_IN "unsigned char*"
+
+///////////////////////////////////////////////////////////
+// Global functions
+//
+void MgInitializeWebTier(STRINGPARAM configFile);
\ No newline at end of file



More information about the mapguide-commits mailing list