Sorry, A typo in my last email.

*GLPK version is 4.57.*
---------- Forwarded message ----------
From: usa usa <[email protected]>
Date: Wed, Dec 16, 2015 at 11:08 PM
Subject: Re: [Help-glpk] build glpk.dll for C# so that I can call it from
VS2013 on win7.
To: Heinrich Schuchardt <[email protected]>
Cc: [email protected]


Hi,

I have downdloaded GPLK for C# from
http://sourceforge.net/projects/glpk-cli/.
I have installed it and passed all install test on win 7.

GLPK version is
*4.57*
Now, I am trying to write a simple C# program from Visual Studio 2013 as
follows:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using org.gnu.glpk;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("GLPK " + GLPK.glp_version()); *// Got
exception here*
        }
    }
}

But, I got

*exception: An unhandled exception of type 'System.*
*TypeInitializationException' occurred in ConsoleApplication1.exe*

*Additional information: The type initializer for 'org.gnu.glpk.GLPK' threw
an exception.*
>From the README file of the package, I saw that

"For building and running your own application you will need the following
files
from the w64 directory:

* glpk\_?\_??.dll - the GLPK native library
* libglpk\_cli\_native.dll - the GLPK for C#/CLI native library
* libglpk\_cli.dll - the GLPK for C#/CLI assembly"

When I was tryingto add them as reference to my C# prpject , I got:



*A reference to "C:\myPATH\glpk_4_57.dll" could not be added. Please make
sure that the file is accessible and that is a vaid assembly or COM
component. *
i got the same error for libglpk_cli_native.dll.

Only libglpk_cli.dll can be added.

Do I miss something here  ?

Why the installation test can be apssed (printed out GLPK version) but I
cannot run the same program from Visual Studion 2013 ?

Any help would be appreciated.

Thanks


On Wed, Sep 16, 2015 at 9:04 AM, Heinrich Schuchardt <[email protected]>
wrote:

> GLPK is C software. C# is a different programming language. You cannot
> compile C as C#. You need a C compiler.
>
> But you can call a C language DLL from C#.
>
> Best regards
>
> Heinrich Schuchardt
>
> http://www.xypron.de
>
> Am 16.09.15 um 14:10 schrieb usa usa
>
> > Hi, Heinrich, thanks.
> >
> >
> >
> > The link https://en.m.wikibooks.org/wiki/GLPK/Windows is about building
> >
> > GLPK by Visual C++.
> >
> >
> >
> > I would like to build it by Visual C#.
> >
> >
> >
> > Any help would be appreciated.
> >
> >
> >
> > thanks
> >
> >
> >
> >
> >
> > On Wed, Sep 16, 2015 at 1:00 AM, Heinrich Schuchardt <[email protected]
> >
> >
> > wrote:
> >
> >
> >
> > > See batch files in w32 and w64 directory.
> >
> > >
> >
> > > Read https://en.m.wikibooks.org/wiki/GLPK/Windows
> >
> > >
> >
> > > Or simply use binaries provided by
> http://sourceforge.net/projects/winglpk
> >
> > > /
> >
> > >
> >
> > > Best regards
> >
> > >
> >
> > > Heinrich Schuchardt
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > > usa usa <[email protected]>schrieb:
> >
> > >>
> >
> > >> Hi,
> >
> > >>
> >
> > >> I would like to build glpk.dll for C# so that I can call it from
> VS2013
> >
> > >> on win7.
> >
> > >>
> >
> > >> I downloaded  http://ftp.gnu.org/gnu/glpk/glpk-4.55.tar.gz
> >
> > >>
> >
> > >> But, the INSTALL document only talked about how to build and install
> it
> >
> > >> on linux.
> >
> > >>
> >
> > >> How to build it in VS2013 to get the .dll ?
> >
> > >>
> >
> > >> Any help would be appreciated.
> >
> > >>
> >
> > >> thanks
> >
> > >>
> >
> > >>
> >
> > >>
> >
> > >> _______________________________________________ Help-glpk mailing list
> >
> > >> [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
> >
> > >
> >
> > >
>
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to