hosseinmoein / DataFrame

C++ DataFrame for statistical, Financial, and ML analysis -- in modern C++ using native types and contiguous memory storage
https://hosseinmoein.github.io/DataFrame/
BSD 3-Clause "New" or "Revised" License
2.38k stars 298 forks source link

in dynamic libraries, get_column returns an empty data vector #264

Closed fxsts closed 8 months ago

fxsts commented 9 months ago

When using hosseinmoein DataFrame in dynamic libraries, get_column returns an empty data vector, but is normal in static libraries and executable programs.

hosseinmoein commented 9 months ago

Do you mean the Windows DLL? If so, I am not familiar with Windows development environment. May be @SpaceIm or @yssource can help

fxsts commented 9 months ago

Yes, Windows DLL. Whether the dataframe is compiled into a static library or a dynamic library, when used in Windows DLLs, get_ column return empty vector. However, in executable programs or static libraries, the returned data is correct.

hosseinmoein commented 9 months ago

This may help https://stackoverflow.com/questions/44612626/dll-static-vector-which-is-filled-up-at-dll-s-initialization-time-returns-zer But, as I said I am not a Windows programmer.

fxsts commented 9 months ago

After many tests, DataFrame cannot be used in the windows dll, and the returned vector is empty. For example, A is an executable program that defines DataFrame instance D1; B is dll, A passes D1(a reference or pointer) to B, adds data in B, uses get_column in A to get the data of D1, and returns a vector that is still empty. Is it related to DataFrame using vector?

hosseinmoein commented 9 months ago

I am not a windows programmer but my gut feeling is that you are not using DLL the correct way. DLL is a very convoluted piece of engineering. You either have to ask a Windows programmer expert or open a question in stack overflow.

fxsts commented 9 months ago

Hello,Mr. Hosseinmoein

1,I have compiled the library myself, and also compiled it through Conan.Used it in windows dll,get_column returns emtpy vector. 2,I have compiled the library myself, and also compiled it through Conan.Used it in ubuntu(ver22.04) ,get_column returns the correct data. 3,windows and ubuntu platforms, development tool is CLion, through cmake build, test code is exactly the same.

At 2023-10-24 21:24:18, "Hossein Moein" @.***> wrote:

I am not a windows programmer but my gut feeling is that you are not using DLL the correct way. DLL is a very convoluted piece of engineering. You either have to ask a Windows programmer expert or open a question in stack overflow.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

hosseinmoein commented 9 months ago

Writing it here doesn't help. Open an issue on stack overflow and describe it in terms of STL vectors.

fxsts commented 8 months ago

Sorry,Mr. Hosseinmoein,not replying on time, the following is a little personal understanding: 1, in the windows dll encountered the get_column return empty vector problem, and there is no error or stack overflow problem, the reason is most likely std::vector in windows itself (SIOF). 2, dataframe uses std::vector to store column data, and SIOF problems are inevitable when used in windows dll.

  1. I don't know if dataframe has any plans to promote under windows, and I don't know if other containers can be used to avoid this problem.
hosseinmoein commented 8 months ago

DataFrame is being used by several teams on Windows. So It is already useable on Windows. By "stack overflow" I mean the internet site (https://stackoverflow.com) where you can go and ask questions. Since I don't know Windows programing, I suggest you go to stack overflow and ask the question there.

fxsts commented 8 months ago

Currently, this problem only occurs in windows dll, static libraries and executables on windows systems are normal, as are linux and mac os. I wonder if I could refer one of the teams to ask how to use dataframe in windows dll.