External C++ packages in edem API

Guozhen Li
Guozhen Li Altair Community Member
edited July 2023 in Community Q&A

Hi,

I want to write a vector to an excel file in EDEM API. So I installed an external library named libxlsxwriter in visual studio environment and use functions by including a header file: #include "xlsxwriter.h".

Then I wrote a function based on the library,like save_excel(vector_to_be_saved). This function works well in a seperate cpp file, either debug or release in Visual Studio Local Windows Debugger, it creates an xlsx file with vector information.  In my API project, I call this function only once at the stopping function:

void CFieldQuery::stopping(NApiCore::IApiManager_1_0& apiManager)
{
    save_excel(Agglomerates_over_time);
}

However, I could not load the generated dll file from my api project to EDEM. When I was trying to load the dll, this error message below shows up. But if I comment the function save_excel(vector_to_be_saved), the dll could be loaded, so I believe the problem is solely caused by this function. Could anyone figure out what is wrong with my code?

image

Tagged:

Answers

  • RWood
    RWood
    Altair Employee
    edited July 2023

    Hi,

    Hard to say without knowing what's in the dll. If you don't have the src for it then you might not be able to tell.

    Only thing that jumps to mind, is that CFieldQuery (the name of the class I see in your code snippet) was originally a body force, but you're loading the dll in the Particle to Particle contact models. I don't know your plug-in set up but are you definitely loading it in the right place?

    Cheers,

    Richard