Git Product home page Git Product logo

Comments (3)

RaniAgus avatar RaniAgus commented on July 27, 2024 1

Comprob茅 la integridad para los casos reflejados en # 28 y todo anda joya 馃憤馃徎

Vamosss.馃殌馃殌

Es posible referenciar a una biblioteca est谩tica como si fuese una biblioteca compartida.
El caso contrario (biblioteca din谩mica referenciada como biblioteca est谩tica) falla como debe.

Est谩 bien, en gcc ambas bibliotecas se referencian igual al momento de compilar (-L para incluir la ruta, -I para incluir los headers y -l para incluir la biblioteca en s铆).

Lo que cambia es que al incluir una static library se compila todo el c贸digo en el binario, mientras que para la shared solo se chequean los headers y el c贸digo se carga en runtime, por lo que hace falta setear LD_LIBRARY_PATH.

Parte de esto est谩 explicado en la gu铆a, 驴cre茅s que hace falta alguna revisi贸n?

from so-project-template.

RaniAgus avatar RaniAgus commented on July 27, 2024 1

Update de este issue antes de cerrar: otra diferencia entre SHARED_LIBPATHS y STATIC_LIBPATHS es que el makefile se basa en cada variable por separado para determinar si la dependencia es un .so o un .a:

DEPS = $(foreach SHL,$(SHARED_LIBPATHS),$(SHL:%=%/bin/lib$(notdir $(SHL)).so)) \
$(foreach STL,$(STATIC_LIBPATHS),$(STL:%=%/bin/lib$(notdir $(STL)).a))

Y llama a su makefile para recompilarla de esta forma poco est茅tica (?):

.SECONDEXPANSION:
$(DEPS): $$(shell find $$(patsubst %bin/,%src/,$$(dir $$@)) -iname "*.c") \
$$(shell find $$(patsubst %bin/,%include/,$$(dir $$@)) -iname "*.h")
make --no-print-directory -C $(patsubst %bin/,%,$(dir $@))

B谩sicamente, una expansi贸n "ejemplo" ser铆a:

# static lib : buscar los .c y .h en la carpeta de la izquierda, reemplazando 'bin' por 'src' o 'include' seg煤n corresponda 
../static/bin/libstatic.a : ../static/src/utils/hello.c ../static/include/utils/hello.h
 	# ejecutar make en la carpeta de la izquierda, sin 'bin'
 	make --no-print-directory -C ../static/

from so-project-template.

jlsuh avatar jlsuh commented on July 27, 2024

Genial rani 馃憤馃徎

Quiz谩s sea oportuno aclarar este caso en la secci贸n de Shared Libraries explicando esto mismo (para los futuros curiosos como yo que intenten clavar un clavo con una sierra 馃憖).

from so-project-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.