numenta / nupic.core-legacy

Implementation of core NuPIC algorithms in C++ (under construction)
http://numenta.org
GNU Affero General Public License v3.0
272 stars 276 forks source link

nupic.core can be built as shared lib #167

Open oxtopus opened 10 years ago

oxtopus commented 10 years ago

Ideally, nupic.core build optionally accepts -DBUILD_SHARED_LIBS=true CLI option to build libnupic_core.so (on linux systems, for example) as a shared object.

rhyolight commented 10 years ago

See discussion about Windows DLL building at https://github.com/numenta/nupic.core/pull/184#issuecomment-57468663.

rcrowder commented 10 years ago

Ahmed and I was discussing this in a Gitter room last night. He's made an initial stab at this and got it built as a DLL and linked to the helloregion example. All looking good on windows.

DLL Feature branch https://github.com/kandeel/nupic.core/tree/dll Build histories https://ci.appveyor.com/project/kandeel/nupic-core/history Packaging https://ci.appveyor.com/project/kandeel/nupic-core-393/build/artifacts

One blocking question is how we handle labeling of exportable Classes and functions. Our discussion revolved around class Visibility http://gcc.gnu.org/wiki/Visibility By placing -fvisibility=hidden on all GCC compiles to make everything hidden from export by default. A pre-processor definition can then decorate at the class declaration level to export an entire class or drill down and specify individually class functions to export. All that came from reading http://stackoverflow.com/questions/2839504/is-there-a-def-file-equivalent-on-linux-for-controlling-exported-function-names?rq=1

Definitely available as a GCC option in 4.3.3, Travis is using 4.6.3 at the moment. Clang and OSX look like it can handle that option too https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html

For the time being Ahmed has chosen NUPIC_EXPORTS for the pre-processor definition e.g. https://github.com/kandeel/nupic.core/commit/c4dcafef747acdb6bdc12756da0cf5a178815108

Is this ok to use, or rather something else?

rhyolight commented 10 years ago

@rcrowder said:

For the time being Ahmed has chosen NUPIC_EXPORTS for the pre-processor definition e.g. kandeel@c4dcafe

Is this ok to use, or rather something else?

Any comments, @scottpurdy / @breznak / @oxtopus ?

scottpurdy commented 10 years ago

There is an export macro NTA_EXPORT defined in src/main/types/Types.h

rcrowder commented 10 years ago

Excellent, thank you Scott. I believe Ahmed has already made the change in the windows branch to use this define now.

rhyolight commented 9 years ago

@oxtopus You tagged this as "in progress"... still true?

rhyolight commented 8 years ago

Please review this issue

This issue needs to be reviewed by the original author or another contributor for applicability to the current codebase. The issue might be obsolete or need updating to match current standards and practices. If the issue is out of date, please close. Otherwise please leave a comment to justify its continuing existence. It may be closed in the future if no further activity is noted.

breznak commented 8 years ago

still valid, only static .a lib is generated.