Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

GLPK/C-Sharp

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

C# is a programming language, designed by Microsoft, and described by some as similar to Java Dormann Scott The history of C# http://geekswithblogs.net/sdorman/archive/2007/09/26/The-history-of-C.aspx 2007. An open source implementation of C# is provided by the Mono project. C# has been standardized under the following documents: ECMA-334 — C# Language Specification ISO/IEC 23270:2006 — Information technology – Programming languages – C#. GLPK for C#/CLI GLPK for C#/CLI provides a C# and common language interface (CLI) binding for GLPK. It is licensed under GPL V3. The coding is generated using SWIG. GLPK for C#/CLI supports callback and terminal listeners. Errors occurring in the GLPK native library are thrown as C# exceptions. All functions of the GLPK API are available as methods of the GLPK object as shown in the example below: using System; using org.gnu.glpk; class Program { static void Main (string[] args) { Console.WriteLine ("GLPK " + GLPK.glp_version ()); } } Marshalling C# can call C library functions directly using marshalling. The following program invokes glp_version() to output the version of the GLPK library. /* * This program demonstrates calling the GLPK library with C#. */ using System; using System.Runtime.InteropServices; public class Test { [DllImport ("glpk")] static extern IntPtr glp_version(); public static void Main(string[] args) { Console.WriteLine("GLPK " + version()); } public static string version() { return Marshal.PtrToStringAnsi(glp_version()); } } To compile the program with Mono use mcs test.cs To compile the program with Visual C# use csc test.cs Visual Studio When GLPK is compiled with Visual Studio C++, both .dll and .lib files are created. The easiest (usual) way to the use GLPK in a Visual Studio C# project in this case is to make the C++ GLPK project a dependency for the C# project and include the .lib file. GLPK# GLPK# (GLPK Sharp) provides a C# language binding for GLPK and is licensed under CeCILL version 2. GLPK# is written in C++/CLI and would normally be statically linked to GLPK. As at July 2012, GLPK# supports most of the GLPK 4.45 API, including terminal callbacks and branch-and-cut callbacks. See the dual French/English project website for details. References