Re: [linux-audio-dev] LADSPA Update (http://www.ladspa.org)

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] LADSPA Update (http://www.ladspa.org)
From: David Benson (daveb_AT_idealab.com)
Date: Fri May 19 2000 - 01:41:20 EEST


> >As C++ was used, the plugin library references the standard C++ library for
> >supporting functions - specifically version 2.9 if I remember correctly.
> >Does this mean that the plugin will ONLY work with 2.9? This is a bit of a
> >problem IMHO. Would this problem go away if the plugins were to be
> >rewritten in C, or would specific C library versions then be required?
>
> there's a deeper problem here too. the dynamic linker under linux will
> not "chain link" - if an *explicitly* dynamically loaded (i.e. dlopen)
> module requires C++ libs, but they are not loaded, my impression is
> that the link will fail.

this isn't true.

it is also not true that you can avoid libstdc++
or whatever by "not using the library". it's
hard (but doable i guess) to avoid builtin_new, builtin_delete,
since the latter is automatically added to all destructor.
(except those which overwrite destroy, i guess...)

also cf RLTD_GLOBAL for the another important link direction
(shared symbols amongst plugins).

all this despite rather disliking c++ :)

no change is required. someone must've though of this.

see this test program:

#! /bin/sh

# Create tplug.cc
cat <<"EOF" > tplug.cc
#include <iostream.h>

extern "C" void print_hello_world();

void print_hello_world()
{
        /* nontrivial c++ use */
        cout << "hello world" << endl;
}
EOF

# Create tmain.c
cat <<"EOF" > tmain.c
#include <stdlib.h>
#include <dlfcn.h>
#include <stdio.h>
main() {
        void* symbol;
        void* module;
        if ((module = dlopen("./tplug.so", RTLD_NOW)) == NULL
         || (symbol = dlsym(module, "print_hello_world")) == NULL) {
                fprintf(stderr, "dlerr: %s\n", dlerror());
                abort();
        }
        (* ( (void(*)()) symbol ))();
        return 0;
}
EOF

gcc -fPIC -DPIC -o tmain tmain.c -ldl
g++ -fPIC -DPIC -shared -o tplug.so tplug.cc

./tmain || echo "test failed"

exit 0

==================================================

and yes, i know that if tplug defined _init this wouldn't work.
i'm sure there's an easy fix ( -nostartuplib? )

-dave


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri May 19 2000 - 02:42:59 EEST