[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Advice on C++ and dynamically linked functions
From: |
E. Joshua Rigler |
Subject: |
Re: Advice on C++ and dynamically linked functions |
Date: |
Tue, 14 Aug 2001 09:13:34 -0600 |
Once again I discovered the error of my ways only moments after posting
a question to the list, and I did so by actually doing what you
suggested Pascal. It turns out that mkoctfile (or g++, via mkoctfile)
was finding the shared library just fine. The size of my resulting .oct
file, however was almost the same size, no matter whether I used the
static or dynamically linked library because of the -O2 option that
mkoctfile uses by default. I removed it and the file size was cut in
half when linked to the dynamic library!
Does anyone know exactly what kind of optimization the -O2 option does?
Will it hurt my performance much if I leave it off? I read the gcc man
page, but I guess I didn't really understand most of what it had to
say. One possibly unique thing about my function is that it has a
single nested switch block, with almost 300 cases! None of the cases is
much more than 10 lines of code though, usually less. Other than that,
it is a relatively simple function.
-EJR
P.S. Yes, I know that a 3000+ line function is ridiculous, but that's
the way this library is designed. It has a single function that is
passed variable length argument lists, mostly composed of long integers
defined via macros, with almost 300 different calling sequences!
UUUUUUGGGGGLLLLLYYYYY! (but very fast)!
Pascal Fleury wrote:
>
> Hi !
>
> Well, what if you try to make the static library "invisible" to the
> compiler for a moment, like in moving it away during the call to mkoctfile ?
> This is a hack, but might solve your problem in the short time.
>
> Otherwise, mkoctfile should be analysed and modified.
>
> Pascal
>
> E. Joshua Rigler wrote:
>
> >This is my second time asking, but maybe this is a little clearer...
> >
> >I am writing a C++ wrapper for a C library for use as a dynamically
> >linked octave function (.oct file). I am not very familiar with dynamic
> >linking. How do I get mkoctfile to _dynamically_ link to my dynamic C
> >library? I believe it is only linking to the static library, and thus
> >creating a HUGE executable (I've only implemented less than half of the
> >functions in the library, and I already have a > 1MB .oct file). Do I
> >need to modify mkoctfile?
> >
> >-EJR
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------