I need to do a small [em]linux[/em] project. It is not something I do often. I was wondering if anyone could help me out with a simple example.
All I need are:
An example of a c++ shared object dynamic library (c++, using g++ to compile) that has 3 functions:
An init() function that takes a callback from the calling program,
a start() function that then calls the callback every 30 seconds,
and an end() function that stops this process.
and
A simple example app that just loads that library, calls the init function (passing a callback to a function within the example) and calls the start function.
Thatâs it. If anyone could point me to some usable tutorials or references to get that trivial example up and running, it would be really helpful. I have much more to do, but upon that base I can build the rest.
I know there are people here that could generate that in 5 minutes⌠anyone available?
I just assumed that the instructions provided earlier had got the job done. I can certainly whip this up, but I (and I suspect a lot of others here) follow a philosophy of a) âshowing howâ is free b) âdoing forâ is not free ⌠with OSS projects being the exception to rule (b).
I worked on a Linux project with shared libraries for five years. At the beginning of the project I found instructions similar to the referenced. Even with the instructions it was a pain. every few years we would need to go back to the instructions to add another library. consider the instructions a fishing lesson.
Yeah - totally get that, and I am painfully aware that I am probably coming across as overly harsh. I love being part of and contributing to the community, and just to not be a butthead about the whole thing, Iâll try to gen up an example this weekend, time permitting.
<rabbit_trail>
@ mcalsyn - you bring up an interesting point about getting compensated for ones contribution. There are a lot of members who are very giving with their time and talent.
It would be interesting if GHI could setup a program that would allow other users to âgiftâ GHI products or gift cards to other users as a way of saying Thank You. If GHI handled it then personal information, like shipping addresses, wouldnât have to be made public. Gifts could also be given anonymously.
Just thinking out loud. Sorry for the rabbit trail.
Itâs a fine idea, but I donât feel any need for anonymity, and I guess Iâd like to see GHI spend their cycles building something other than a gift registry :).
With that said, there is a fine line here between being helpful/community-minded and directly contributing to someone elseâs paying gig (not saying thatâs what this is, because @ mtylerjr hasnât said one way or the other). And within the paying-gig scenario, there is another distinction to be made between âhelp me doâ and âdo for meâ.
@ mcalsyn - you make a good point about how to do versus do⌠I like to make my responses to questions very short, with pointers to the necessary information to allow the OP to answer their own question.
I got a moment to poke at it this afternoon. Here is a solution tested in Visual Studio with the VS for Linux Development extension, and Eclipse CDT. Both were running against Ubuntu 16.04. If the problem is the actual plumbing of setting up VS or Eclipse projects and the previously provided links werenât enough, then sing out and I will drop some zips of the projects. Side note: Making it work in VS involves some tricks that are not documented anywhere I could find in the search engines. I will probably write up a blog on that. This code would also work in a VC++ project that created a dll for Windows.
Library header (mylib.h in the shared library project):
This is one of the reasons I have left a number of the technical groups on LinkedIn. There was far too many, âgive me the code for my projectâ requests and very little in the way of them trying first and then asking questions. Most requests were from students working on their projects and for the most part, Google would have given them the answer but they were too lazy to even do that.
I donât mind helping, even for commercial type work if the information is small as Iâve received help before myself for similar type work. I draw the line at supplying full code or designs though.
It would be a pretty pathetic paying gig if this simple project was the project they were paying for, lol.
I just needed some examples of a linux shared library periodically calling back a client (as well as setting up Eclipse CDT in Ubuntu, which I havent done in awhile)
Everything I try to do in Eclipse seems to be fighting it. I am so used to Visual Studio.
Thanks for the help, guys.
I am really interested in these linux extensions for VS though. I had no idea they existed.