Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Jewel
May 2, 2009

nielsm posted:

Inner classes. Anonymous classes.

Java allows you to declare a class inside a class, and even give that class access restrictions (public/protected/private). Those inner classes can naturally inherit from any other class visible to it, and implement any interface visible to it, and you can then have functions returning objects of those public classes/interfaces that the inner class implements.

Java also lets you make anonymous classes, a class that doesn't even have a name by itself, and is defined entirely inside a method of another class. Those are useful for passing short bunches of code around, especially when it doesn't make sense to have that code normally accessible outside the method creating it.


Some example-ish stuff:
(Might contain syntax errors, it's been a long time since I last wrote anything in Java.)

GameEvent.java
Java code:
interface GameEvent {
  void execute();
}
Head.java
Java code:
class Head implements GameObject {
  // this declares an inner class only visible to the Head class itself.
  // because this is not a static inner class, it objects of it implicitly have access
  // to the object that created it, i.e. the EyeBlinkEvent knows which Head created it
  // so it will blink the eyes of that head.
  private class EyeBlinkEvent implements GameEvent {
    public void execute() {
      leftEye.close();
      leftEye.open();
      rightEye.close();
      rightEye.open();
    }
  }
  private Eye leftEye;
  private Eye rightEye;
  public void run(GameState state) {
    EyeBlinkEvent e = new EyeBlinkEvent;
    state.enqueueEvent(100, e); // 100 milliseconds from now
  }
}
Stomach.java
Java code:
class Stomach implements GameObject {
  private List<Nutrient> contents;
  private CirculatorySystem circulatorySystemLink;
  public void run(GameState state) {
    // this declares an anonymous class that implements the GameEvent interface
    // and creates an object of that class, passing it into the enqueueEvent method
    state.enqueueEvent(2500, new GameEvent {
      public void execute() {
        // digest some of the contents of the stomach and send it into the circulatory system
        circulatorySystemLink.addNutrient(contents.remove(0));
      }
    });
  }
}

Woah. That's neat! I haven't gotten too indepth with C++ yet, used to python mainly, but does that class-inside-class functionality remain there? If not, what would be the best way to do it there?

Adbot
ADBOT LOVES YOU

nielsm
Jun 1, 2009



Jewel posted:

Woah. That's neat! I haven't gotten too indepth with C++ yet, used to python mainly, but does that class-inside-class functionality remain there? If not, what would be the best way to do it there?

C++ does allow you to declare types within class/struct declarations, but it doesn't have the "inner class" semantics of Java. (It's comparable to a "static inner class" in Java, those don't have the implicit reference to the creating object.) Rather, declaring a type inside a class in C++ is effectively just a namespacing of it.

On the other hand, C++ lets you make a clearer physical distinction between public interface (header files) and implementation (cpp files) and add lots of private details in the implementation. If your header file only declares an abstract class and maybe a couple of global functions that return references (smart pointers) to instances of that abstract class, then your implementation file(s) can declare multiple additional classes that all derive from the abstract class in the public interface, and those get returned from the publically declared functions.
An important tool in making that kind of public interface/private implementation in C++ is using the anonymous namespace:
C++ code:
namespace {
  // anything declared within this is only visible inside the same translation unit
}
That prevents any of the private symbols in the implementation from "leaking" during link. However you still don't need any additional qualifiers when referencing things inside the anonymous namespace, you just can only reference them in the same translation unit and after the declaration.

Another thing you can use in C++ is "friend" declarations, that allows a class to declare that functions not member of the class are still allowed to access the protected and private fields of the class. It's usually something you should use sparingly. (I can't remember when I last time had to use a friend declaration.)

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Keep in mind this is just sort of a workaround for anonymous functions and lambdas, which I think C++ does support natively.

mjau
Aug 8, 2008

Suspicious Dish posted:

Keep in mind this is just sort of a workaround for anonymous functions and lambdas, which I think C++ does support natively.

It does in C++11. The stomach example could be done like this:
C++ code:
class Stomach : public GameObject {
private:
  List<Nutrient> contents;
  CirculatorySystem circulatorySystemLink;
public:
  void run (GameState &state) {
    // capture this to access members
    state.enqueueEvent(2500, [this]{
      // digest some of the contents of the stomach and send it into the circulatory system
      circulatorySystemLink.addNutrient(contents.remove(0));
    });
  }
};
(e: well, you probably wouldn't define the run method inline in the class like that. also, that's not an stl list)

mjau fucked around with this message at 21:17 on Dec 8, 2012

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
Not a programming question but a CoC request thingy.

Mjau's post contains some c++ specific syntax highlighting, which is implemented with code=cpp. What languages are supported with this? What are their keywords? Maybe this info could go into the CoC faq thread and/or the BBcode link at the left of the 'make a post' page.

Mario
Oct 29, 2006
It's-a-me!
From the SAVB changelog, linked at the bottom of every page:
code:
* [code] tag now does syntax highlighting.  It is triggered by using
  [code=syntax]. Supported syntaxes: C# (cs, csharp), Ruby (rb, ruby),
  JavaScript (javascript, js), Markdown (md, markdown), ActionScript (as, as2,
  as3, actionscript), Visual Basic (vb, vbscript), Objective-C (objc,
  objectivec), Batch Files (dos, bat),  C++ (cpp), PHP, XML, CSS, SQL, INI,
  SmallTalk, CoffeeScript, GO, Bash, Diff, Lua, Lisp, Java, Python, Perl,
  Django, Delphi, Apache.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Who do we have to talk to about getting new languages added to that list? There's a lot of discussion regarding R and Matlab in threads on scientific/numerical computing, and having syntax highlighting would be a godsend.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Choochacacko, but there's probably better things for him to be doing right now.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Mario posted:

From the SAVB changelog, linked at the bottom of every page:

Hey, thanks.

Jewel
May 2, 2009

mjau posted:

List<Nutrient> contents;
[...]
(e: also, that's not an stl list)

What do you mean? What is it then?

Also, since I think I never worked it out last time I was coding, how would I go about making a list of child classes in C#, like, uh. If I had a Animal, Avian::Animal, Dog::Animal, Cat::Animal, and Bird::Avian, how would I make a list of Animals that can store every one of those extended classes (Which would be, uhm, Dog, Cat, and Bird, I think. Avian and Animal would be.. Interfaces? Which means they can't be used by themselves? I'm bad with terminology, correct me if I'm wrong!)

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

nielsm posted:

Another thing you can use in C++ is "friend" declarations, that allows a class to declare that functions not member of the class are still allowed to access the protected and private fields of the class. It's usually something you should use sparingly. (I can't remember when I last time had to use a friend declaration.)

"Hey, Bjourne, I got this great idea. Let's build up walls of encapsulation, and then allow people to poke right through it because they're BFFs forever!"

"Great idea, I'll get right on it! Thanks, BFF."

"No probs. I've got your back."

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
It doesn't really break encapsulation: classes declare their friends, and friendship isn't transitive or anything. The only thing that totally destroys meaningful access control without an ODR violation (and if you're violating ODR anyway, you might as well just use your own class definition making everything public) is if you befriend a class template.

The real problem is the C compilation model; the logical way to do access control is file-by-file, but that doesn't really work in a world that get modularity and re-use from textual inclusion.

mjau
Aug 8, 2008

Jewel posted:

What do you mean? What is it then?
It's some kind of custom list structure, probably! Not that that's a problem, I just mentioned it because std::list's remove method does something else than Java's List's remove. It'd remove all elements that compare equal to 0 in stead of just popping and returning the first one, and it returns void so it wouldn't compile anyway. For std::list you could use front() to get the first element (a reference), and then pop_front() to remove it afterwards. (You can't just use pop_front by itself since that returns void too.)

mjau fucked around with this message at 09:29 on Dec 9, 2012

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

rjmccall posted:

It doesn't really break encapsulation: classes declare their friends, and friendship isn't transitive or anything.

It seems absurdly silly to build up walls of access control, and then poke right through them.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Suspicious Dish posted:

It seems absurdly silly to build up walls of access control, and then poke right through them.

"I personally can't think of a use case for this feature, hence the feature is and will always be terrible".

It makes writing unit tests a whole lot less clunky :ssh:

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
More than that, sometimes the right unit of encapsulation is not a single type — maybe you have several types that work in tandem, and nesting one inside the other isn't suitable. Java's default access control serves the same purpose. A good example would be a tightly-coupled serialization library which you'd like to have access to stuff you wouldn't really want to otherwise expose.

Actually, Java's access control is a lot nicer than C++'s; you can build up an entire package-internal API in Java and still enforce class-level encapsulation, whereas friendship in C++ is really invasive. But something with invasive access can be careful and use less than is granted, whereas without any way to couple things at all you're just hosed.

The other use for friends — and I think this was a lot of the original motivation — is to let classes declare coupled free functions, most notably operators. Operators have grown, er, organically in C++, so this is less important now, but at one point this was seen as a major gain.

emanresu tnuocca
Sep 2, 2011

by Athanatos

nielsm posted:

Inner classes. Anonymous classes.

Took me a while to wrap my head around all of this but it was all very helpful, many thanks.

Catalyst-proof
May 11, 2011

better waste some time with you
I've gotten myself into a position where I'm in charge of a small web application that talks to other internal services within my company. This has also brought with it the need to manage the project, expectations for the platform team, and communication with other teams, as well as the various technical aspects of keeping the application up-to-date, staying ahead of show-stopper bugs, and supporting the application's use. Is there any good literature about this kind of technically-oriented project management?

Master_Odin
Apr 15, 2010

My spear never misses its mark...

ladies
I'm having issues coming up with the best way to sort an array of strings that have the following format:
code:
0 1 2.0 0
I want to sort the strings based on the final number in that, but I'm just not sure what I need to do. I feel like there's some trivial manner to do it, but it just escapes me at the moment.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Your language probably has a way to say "Sort this sequence of things, using this function that I'm going to provide whenever you need to compare two of them".

Figure out what that is, and you've reduced the problem to "How can I compare two of these strings and tell which one is 'bigger'?"

The fiddly way is to start at the end of the string, and manually convert it to an integer character by character until you find a non-digit character. The lazy way is to use a regex or something to pull out the last series of digits, and then convert that to a number or whatever. Pick whichever one you feel like, really.

Jewel
May 2, 2009

Master_Odin posted:

I'm having issues coming up with the best way to sort an array of strings that have the following format:
code:
0 1 2.0 0
I want to sort the strings based on the final number in that, but I'm just not sure what I need to do. I feel like there's some trivial manner to do it, but it just escapes me at the moment.

If python, I'd use a lambda key:

Python code:
import random

arr = []

##DISREGARD THIS VVV
for i in range(10):
    numberArray = random.randint(0, 9), random.randint(0, 9), float(random.randint(0, 99))/10, random.randint(0, 99) #You'd normally just pass in them instead of generating them obviously
	#generated them as an array becase it's easier
    
    arr.append(' '.join((str(x) for x in numberArray))) #converting the numbers from an array to a string
##DISREGARD THIS ^^^

print "Original array:"
for i in arr:
    print "\t",i

print "\n------\n"

print "Sorted array:"
for i in sorted(arr, key=lambda k: float(k.split(" ")[-1])): #using float here because just in case the last number was a float or w/e it wouldn't break it
    print "\t",i
Output:

pre:
Original array:
	8 9 0.3 10
	2 6 8.2 80
	6 3 7.7 70
	0 2 2.2 17
	9 2 7.9 2
	6 1 0.1 90
	7 5 8.3 57
	9 6 5.8 97
	2 7 3.0 25
	0 1 0.9 47

------

Sorted array:
	9 2 7.9 2
	8 9 0.3 10
	0 2 2.2 17
	2 7 3.0 25
	0 1 0.9 47
	7 5 8.3 57
	6 3 7.7 70
	2 6 8.2 80
	6 1 0.1 90
	9 6 5.8 97

Jewel fucked around with this message at 10:05 on Dec 10, 2012

tarepanda
Mar 26, 2011

Living the Dream
What is a lambda?

Jewel
May 2, 2009

tarepanda posted:

What is a lambda?

A lambda's kinda.. a one line function, I guess.

Python code:
def square(n):
	return n*n
	
print square(5) #outputs: 25

square2 = lambda n: n*n

print square2(5) #outputs: 25
Edit: Hard to explain why they're useful. This example on a StackOverflow post is pretty cool.

Python code:
def transform(n):
    return lambda x: x + n
f = transform(3)
f(4) # is 7

Master_Odin
Apr 15, 2010

My spear never misses its mark...

ladies

Jabor posted:

Your language probably has a way to say "Sort this sequence of things, using this function that I'm going to provide whenever you need to compare two of them".

Figure out what that is, and you've reduced the problem to "How can I compare two of these strings and tell which one is 'bigger'?"

The fiddly way is to start at the end of the string, and manually convert it to an integer character by character until you find a non-digit character. The lazy way is to use a regex or something to pull out the last series of digits, and then convert that to a number or whatever. Pick whichever one you feel like, really.
I originally wrote a different way to describe my issue, but I erased it and then forgot ot rewrite the language. I'm using Java. I've since found the "Collections" class/"Comparerators" class (or whatever it's spelled like) which is what I guess I'd want to use and have an ArrayList of 4 objects or something?

edit: I realize I should have posted this in the Java thread and will move myself over there. I rewrote my post so many times I completely missed that I got to the point where I wasn't looking at an idea specific thing, but rather language specific. My bad.

Master_Odin fucked around with this message at 10:29 on Dec 10, 2012

nielsm
Jun 1, 2009



tarepanda posted:

What is a lambda?

Stay a while and listen!
Although in the context of Python specifically, it's an anonymous function declared with the "lambda" syntax, and Python's lambda functions can only consist of a single expression whose evaluation result is returned.

Jewel
May 2, 2009

nielsm posted:

Stay a while and listen!
Although in the context of Python specifically, it's an anonymous function declared with the "lambda" syntax, and Python's lambda functions can only consist of a single expression whose evaluation result is returned.

Oh, yeah, that's super neat. It explains what the SO example in my post did, a function within a function.

tarepanda
Mar 26, 2011

Living the Dream

nielsm posted:

Stay a while and listen!
Although in the context of Python specifically, it's an anonymous function declared with the "lambda" syntax, and Python's lambda functions can only consist of a single expression whose evaluation result is returned.

Is lambda syntax consistent across languages?

emanresu tnuocca
Sep 2, 2011

by Athanatos

Master_Odin posted:

I originally wrote a different way to describe my issue, but I erased it and then forgot ot rewrite the language. I'm using Java. I've since found the "Collections" class/"Comparerators" class (or whatever it's spelled like) which is what I guess I'd want to use and have an ArrayList of 4 objects or something?

edit: I realize I should have posted this in the Java thread and will move myself over there. I rewrote my post so many times I completely missed that I got to the point where I wasn't looking at an idea specific thing, but rather language specific. My bad.

Collections.Sort() is a static function that sorts any list according to its 'natural order', you can modify the natural order of a list of objects by implementing the Comparable interface and overriding the 'compareTo' method.

Basically all of this: http://docs.oracle.com/javase/tutorial/collections/interfaces/order.html

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
You should use lambdas sparingly. There's really no difference from an anonymous function, beyond the restrictions that you can't have a docstring, and you can only have expressions.

So, really, only use lambdas in cases where they're immediately obvious, like a very simple sort key (sorted([('a', 13), ('b', 22)], key=lambda (a, b): b)).

Otherwise, just use "def" to make a function and give it a name and docstring, and use all the lines of code you want.

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

tarepanda posted:

Is lambda syntax consistent across languages?

What languages?

qntm
Jun 17, 2009

Master_Odin posted:

I'm having issues coming up with the best way to sort an array of strings that have the following format:
code:
0 1 2.0 0
I want to sort the strings based on the final number in that, but I'm just not sure what I need to do. I feel like there's some trivial manner to do it, but it just escapes me at the moment.

code:
print join "\n", sort { (split / /, $a)[-1] <=> (split / /, $b)[-1] } @strings;

Sad Panda
Sep 22, 2004

I'm a Sad Panda.
I've got a list of 150 or so members and am trying to get the information into some kind of database (although final form will be csv to import into a wordpress blog) so I can present it more usefully. At the minute the data is http://ecprsgpp.wordpress.com/members/ and as you can imagine I'd rather have an automated solution, even if it's imperfect, than spending a whole morning copying and pasting information.

Name (ideally first/last as two seperate fields)
Institution
Postal Address
Email
Website
Research Interests
Recent Publications

That is the information that each member can have, although not all do.

I think that covers everything, let me know if I'm missing anything or this is the wrong thread.

raminasi
Jan 25, 2005

a last drink with no ice

tarepanda posted:

Is lambda syntax consistent across languages?

No more consistent than any other syntax :confused:

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

tarepanda posted:

Is lambda syntax consistent across languages?

Worry more about the semantics than the syntax

Doctor w-rw-rw-
Jun 24, 2008

tarepanda posted:

Is lambda syntax consistent across languages?

I never got into lambda calculus and the wikipedia page at first glance seems to get technical in an offputting way. My explanation will be incomplete, but here goes:

Lambdas are functions you can treat as data (i.e. as variables) - mini-programs, or deferred computations waiting for input, if you will - but not necessarily one-shots, since they may be able to be used multiple times. Basically, just a function, before you give it arguments. A function is just a lambda with a name attached to it.

In python, foo = lambda x: x * 2 is the same as def foo(x): return x * 2.

But let's say you had an array of numbers, let's say one through five, and you wanted to apply the calculation 2x+5 to all of them. Well, the easy way is to just loop over it, and apply a function that does that to all of them, and get the list [7, 9, 11, 13, 15].

Lambdas let you call a function someone passes in on some known input, rather than run a known function on input someone else passes in. In a way you can think of it as an inversion of control - rather than supplying a function with data, you're transforming the data with a function. The difference is subtle, but if you imagine the traditional "black box" input/output diagrams, it's the data inside the black box, and it's the algorithm that's the input, rather than the other way around (algorithm in the black box) - even though the output is the same.

So, instead of thinking of transforming [1, 2, 3, 4, 5] into [7, 9, 11, 13, 15] with 2x+5, you think of it as mapping 2x+5 onto [1, 2, 3, 4, 5], producing the output [7, 9, 11, 13, 15]. The lambda is the representation of the steps necessary for the transformation, and you got your result by mapping the lambda onto the data. The key is that the function is just a special kind of data, and rather than looping over a list to construct a new list, what you *actually* have is a different view of the data.

So why the hell does this matter when 2x+5 is the same thing whether you pass the data in or the function? Well, what if after you did 2x+5 you wanted to then do 6y+3 to the result of that? You could feed in [7, 9, 11, 13, 15] and get [45, 57, 69, 81, 93]. If you have 10 billion numbers then you need to produce the first set of 10 billion numbers, then calculate over those. Easy enough, but looping 20 billion times could be tedious and expensive, particularly if somewhere along the way you decide you only want the first 5 million numbers. Why not just calculate 6(2x+5)+3 = 12x+33 in the first place? Combining those two functions together, then applying that combined calculation to [1, 2, 3, 4, 5] is made possible because you treated the function as the input, and combined the two steps beforehand.

So this is all kind of complex and I'm rambling but the point is that lambdas are most commonly used as a concise way of specifying how to transform data from one form into another, which is one of the foundations of functional programming.

Functional programming has the interesting property of dealing really well with parallelism. So where you might do a for loop over [1, 2, 3, 4, 5], you can instead have a farm of servers doing 1-10,000,000, another doing 10,000,001 to 20,000,000, and so on. And there's really no reason that they have to do it in order, either, you can just assign them some data, and some function to apply to it, and map it over a huge number of computers. This is MapReduce (well, the mapping part, anyway, and a handwave-y explanation at that). Functional programming has other useful approaches to manipulating data, and I would highly recommend learning them.

tl;dr: lambdas and composition of them are a foundation of one kind of abstraction over data.

(to patch up holes in your programming awareness, consider reading Abelson and Sussman's SICP. There's a whole religion around it as the key to programming enlightenment, but I prefer to think of it as just legitimately good. I wouldn't try to understand everything at first, though, but just take what I can get.)

Doctor w-rw-rw- fucked around with this message at 09:32 on Dec 11, 2012

Jo
Jan 24, 2005

:allears:
Soiled Meat
Is there anything like Kerberos which is less of a three-headed bitch to set up? I've heard it's the only game in town, but figured I'd ask to be sure.

I need to do some user/group authentication/authorization.

ToxicFrog
Apr 26, 2008


tarepanda posted:

Is lambda syntax consistent across languages?

In most languages that have them at all, "lambda" and "anonymous function" are synonyms - the term originates in the lambda calculus (where all functions are anonymous) and in many languages the keyword to define an anonymous function is lambda or \ (an ASCII approximation of λ) as a result. An "anonymous function" here is just a function value without an associated name (in the same way '5' is just a numeric value; it doesn't have a name until you assign it one with variable assignment or binding).

In most cases, lambdas have all of the same power as named functions, and many languages don't even draw a distinction; a named function is just an anonymous function that's been assigned a name. In Lua, for example, the definition of a global function "foo" is exactly equivalent to defining an anonymous function and assigning it to the global variable "foo".

It is not quite correct to say that "lambdas are functions you can treat as data"; some languages have first-class functions ("functions you can treat as data") without the ability to create anonymous functions.

In python specifically, lambdas are a heavily restricted type of anonymous function that can consist only of a single expression. I don't recall if Python has general anonymous function support.

nielsm
Jun 1, 2009



ToxicFrog posted:

In python specifically, lambdas are a heavily restricted type of anonymous function that can consist only of a single expression. I don't recall if Python has general anonymous function support.

Python code:
lambda x, y: exec("""
if x > y:
  return x*2+y
elif y > 0:
  return -y
else:
  return None
""", globals(), locals())
:pseudo:

e: okay reading a bit more in the docs for exec() that won't actually work, you can't use return that way.

Jewel
May 2, 2009

I really really love making GBS threads around with python and trying to make things that are weird and not how they were intended to be used. Such as fake if statements in lambdas:

Python code:
>>> foo = lambda x: ("NOPE SORRY", [y/2.0 for y in x])[len(x)>0]
>>> array = [5, 6, 3]
>>> foo(array)
[2.5, 3.0, 1.5]
>>> notarray = []
>>> foo(notarray)
'NOPE SORRY'
Edit: More weird stuff:

Python code:
>>> array = 5, 6, -5, 2, 6, -64, 3
>>> [["WAS NEGATIVE", x/2.0][x>0] for x in array]
[2.5, 3.0, 'WAS NEGATIVE', 1.0, 3.0, 'WAS NEGATIVE', 1.5]
Edit2: One more less-weird but really stupid one before bed :getin:

Python code:
foo = lambda x: -0.741667*(x**5) + 7.20833*(x**4) - 22.2083*(x**3) + 16.2917*(x**2) + 28.45*x + 72
print ''.join([chr(int(foo(x))) for x in range(6)])
Output: Hello!

Jewel fucked around with this message at 21:51 on Dec 11, 2012

Adbot
ADBOT LOVES YOU

The Born Approx.
Oct 30, 2011
What does it mean if a shared library has a name like libblas.so.3.2.1, instead of just libblas.so? I'm trying to compile some code that's getting angry at me because it depends on something called -lblas and it can't find it. I have the libblas.so.3.2.1 in /usr/lib64, but ld doesn't consider this acceptable. If I create a symbolic link called libblas.so and point it to the other file, is that going to work?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply