shared-libraries

External symbol resolving in a dll

淺唱寂寞╮ 提交于 2021-02-08 08:51:06
问题 I'm working on a cross-platform c++/qt project with a plugin system, we are using so files on linux and dll on windows. We are using gcc on Linux and Visual Studio 2010 on Windows through cmake. The problem is our plugins sometimes need to call a function from the application source code, which is working fine on Linux with gcc by just including the header files. But on Visual Studio, we got unresolved external symbol errors. Is it because so and dll files works differently? thank you. 回答1:

Passed array with more elements that expected in subroutine

痞子三分冷 提交于 2021-02-08 05:17:46
问题 I have a subroutine in a shared library: SUBROUTINE DLLSUBR(ARR) IMPLICIT NONE INTEGER, PARAMETER :: N = 2 REAL ARR(0:N) arr(0) = 0 arr(1) = 1 arr(2) = 2 END And let's assume I will call it from executable by: REAL ARR(0:3) CALL DLLSUBR(ARR) Note: The code happily compiles and runs (DLLSUBR is inside a module) without any warning or error in Debug + /check:all option switched on. Could this lead to memory corruption or some weird behaviour? Where I can find info about passing array with

Passed array with more elements that expected in subroutine

无人久伴 提交于 2021-02-08 05:14:30
问题 I have a subroutine in a shared library: SUBROUTINE DLLSUBR(ARR) IMPLICIT NONE INTEGER, PARAMETER :: N = 2 REAL ARR(0:N) arr(0) = 0 arr(1) = 1 arr(2) = 2 END And let's assume I will call it from executable by: REAL ARR(0:3) CALL DLLSUBR(ARR) Note: The code happily compiles and runs (DLLSUBR is inside a module) without any warning or error in Debug + /check:all option switched on. Could this lead to memory corruption or some weird behaviour? Where I can find info about passing array with

Passed array with more elements that expected in subroutine

喜欢而已 提交于 2021-02-08 05:14:21
问题 I have a subroutine in a shared library: SUBROUTINE DLLSUBR(ARR) IMPLICIT NONE INTEGER, PARAMETER :: N = 2 REAL ARR(0:N) arr(0) = 0 arr(1) = 1 arr(2) = 2 END And let's assume I will call it from executable by: REAL ARR(0:3) CALL DLLSUBR(ARR) Note: The code happily compiles and runs (DLLSUBR is inside a module) without any warning or error in Debug + /check:all option switched on. Could this lead to memory corruption or some weird behaviour? Where I can find info about passing array with

C++ custom global new/delete overriding system libraries

梦想与她 提交于 2021-02-07 19:53:10
问题 I'm overriding C++ global new/delete operators on Linux project. It all works nicely in my own code, until I found out that the new/delete symbols in system libraries gets also replaced with my code! This is a very bad problem since it goes way beyond 'level of evil' I intended. So question is how do I prevent the linker/compiler from replacing the new/delete syms from other (system) shared libraries? Or more precisely how do I control what shared libraries link syms from my library? I would

C++ custom global new/delete overriding system libraries

有些话、适合烂在心里 提交于 2021-02-07 19:51:59
问题 I'm overriding C++ global new/delete operators on Linux project. It all works nicely in my own code, until I found out that the new/delete symbols in system libraries gets also replaced with my code! This is a very bad problem since it goes way beyond 'level of evil' I intended. So question is how do I prevent the linker/compiler from replacing the new/delete syms from other (system) shared libraries? Or more precisely how do I control what shared libraries link syms from my library? I would

Cmake Linking Shared Library: “No such file or directory” when include a header file from library

怎甘沉沦 提交于 2021-02-07 18:41:44
问题 I am learning to build a library using Cmake. The code structure for building library is like below: include: Test.hpp ITest.hpp // interface src: Test.cpp ITest.cpp In CMakeLists.txt, the sentences I used to build library is : file(GLOB SRC_LIST "src/iTest.cpp" "src/Test.cpp" "include/Test.hpp" "include/iTest.hpp" "include/deadreckoning.hpp") add_library(test SHARED ${SRC_LIST}) target_link_libraries( test ${OpenCV_LIBS}) // link opencv libs to libtest.so Then I wrote another test file (main

Building Python 2.5 with full Sqlite3 as a user on linux

[亡魂溺海] 提交于 2021-02-07 18:15:13
问题 This is a bit of a complex problem, at least for me. Here it goes: I'm working as a user on linux server and it's safe to assume that installing any package not already installed is simply impossible. Also I need to set up working Python 2.5 (not installed) with working SQLite3 library (Sqlite in any form not installed). What I can do is: 1. Compile Python 2.5 and make it work 2. Compile amalgamation of SQLite3 Anyway - Python 2.5 is supposed to have interaction with Sqlite3 built-in

Sharing global data between a shared library and main

血红的双手。 提交于 2021-02-07 10:35:20
问题 I've got a variable called global_count that I would like to share between the shared library and the main part of the program (and ultimately other libs, but for now I've simplified the testcase). Given the declaration of global_count in globals.cpp: extern "C" { int* global_count; } We compile to create a global.o file: gcc -c global.cpp shared.cpp below will be used to create shared.so : #include <stdio.h> #include "global.h" extern "C" { void init_global_count(int* xp) { printf(

Is it possible to force a range of virtual addresses?

自古美人都是妖i 提交于 2021-02-07 09:22:04
问题 I have an Ada program that was written for a specific (embedded, multi-processor, 32-bit) architecture. I'm attempting to use this same code in a simulation on 64-bit RHEL as a shared object (since there are multiple versions and I have a requirement to choose a version at runtime). The problem I'm having is that there are several places in the code where the people who wrote it (not me...) have used Unchecked_Conversions to convert System.Addresses to 32-bit integers. Not only that, but