Welcome, Guest. Please login or register.

Author Topic: Making a shared library  (Read 2403 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline nyteschaydeTopic starter

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 644
    • Show all replies
    • http://www.nyteshade.com
Making a shared library
« on: October 21, 2011, 06:57:47 AM »
So I've put on my Amiga dev cap again and I am trying to figure out if it's possible to create a shared library of functions that I'll reuse using only C. As far as my compiler options go, I currently have Storm C V3.0 (from the ADCD_2.1 CD) and SAS C/6.50.

If I wanted to create a shared library called test.library that exposed a single void tb_hello() function that printed "Hello Amiga" to stdout using something like printf() or puts() what do I have to do?

I expect the usage would be something like:

#include
#include
#include "libs/test.h"

int main(int argc, char **argv) {
  struct Library *TestBase = (struct Library*)OpenLibrary("test.library",0);
  if (TestBase) {
    tb_hello();
    CloseLibrary(TestBase);
  }
  return 0;
}

If I am totally out of my league with this or I should just be using a link library instead, please let me know. My C is rusty and my Amiga C is even rustier.
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline nyteschaydeTopic starter

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 644
    • Show all replies
    • http://www.nyteshade.com
Re: Making a shared library
« Reply #1 on: October 21, 2011, 07:57:05 AM »
PERFECT! Thanks. I'll look this over. I simply chose ANSI functions because they seemed the simplest to type up in my request. Iterating over an exec list would use more space. :)
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500