librelist archives

« back to archive

Exporting inline functions

Exporting inline functions

From:
Andrej Mitrovic
Date:
2012-10-10 @ 23:36
Hi,

I need to have inline functions exported in the libgit win32 DLL for a
bindings project (for example the git_tree_free function is inline and
not exported). I can't change the GIT_INLINE macro to GIT_EXTERN in
the header file since I get multiple definition errors.

I guess using -DCMAKE_C_FLAGS=-fkeep-inline-functions might even work
on Posix systems where visibility is public by default in shared libs
(afaik), but on Windows the function won't be exported in the DLL
unless it's explicitly marked as exported (which leads me to multiple
definition errors).

As a workaround I could compile a separate DLL (or a static lib) that
has those functions,  but then I'd have to do the same for any
arbitrary platform. Isn't there a simpler way to work around this?

How do other bindings projects work around missing functions in the
DLL/shared lib when they're inline?

Re: Exporting inline functions

From:
Andrej Mitrovic
Date:
2012-10-10 @ 23:48
On 10/11/12, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> I can't change the GIT_INLINE macro to GIT_EXTERN in
> the header file since I get multiple definition errors.

Ah I have the dumbs today. It's in a header file, of course there will
be linker errors. :)
I just have to make it a declaration rather than a definition, and put
a definition to the tree.c file. So that solves that.

Still, a non-invasive approach would be better.