TrianglePP icon indicating copy to clipboard operation
TrianglePP copied to clipboard

DLL/Static Library version?

Open BBlayne opened this issue 1 year ago • 6 comments

I can't seem to get Unreal to accept the library as a Plugin, perhaps I'm making a large oversight but nothing seems to be working. I've successfully before created a plugin from a Dynamic Link Library that had a .Lib and a .DLL file; any chance could you release a version of the library in such a configuration? I tried googling how to do this but couldn't find any tutorial I could understand for an existing library and most examples seem to involve practically rewriting the entire library.

I would appreciate it.

BBlayne avatar Oct 20 '23 19:10 BBlayne

OK, I'll try do hack sth up!

Cheers, mrk

mrkkrj avatar Oct 23 '23 13:10 mrkkrj

OK, I'll try do hack sth up!

Cheers, mrk

Thanks! Also to clarify a static library might also be fine. I'm not sure as I've not made a plugin with just a .lib before so if you are able to provide both so I can see which works better that would be great, a static library might also be safer if any STL types might end up crossing DLL boundaries.

BBlayne avatar Oct 23 '23 14:10 BBlayne

For completeness here's where I'm getting linker errors according to Unreal:

LNK2019	unresolved external symbol "public: __cdecl tpp::Delaunay::Delaunay(class std::vector<class reviver::dpoint<double,2>,class std::allocator<class reviver::dpoint<double,2> > > const &,bool)" (??0Delaunay@tpp@@QEAA@AEBV?$vector@V?$dpoint@N$01@reviver@@V?$allocator@V?$dpoint@N$01@reviver@@@std@@@std@@_N@Z) referenced in function "public: void __cdecl FTrianglePPManager::TestFunc(void)" (?TestFunc@FTrianglePPManager@@QEAAXXZ)

LNK2019	unresolved external symbol "public: __cdecl tpp::Delaunay::~Delaunay(void)" (??1Delaunay@tpp@@QEAA@XZ) referenced in function "public: void __cdecl FTrianglePPManager::TestFunc(void)" (?TestFunc@FTrianglePPManager@@QEAAXXZ)

Edit: D'oh! In the process of trying to figure this out. I went and created a Static Library from the code, but I still got the error above, but it turns out the problem was I didn't replace the original test Lib file I made from my first attempt at building a static library, with the proper one from my successful attempt. After disabling SDL checks, disabling precompiled headers for the two cpp files, and putting in NO_CRT macros and rebuilding, my Unreal Project compiles. To build a static library in case someone else with the same problem comes across this, you just make a Static Library project with Visual studio, delete the precompiled headers, drag and drop the source files into the Project directory, include them into the project, do some configuring to turn off warnings and pch, and then just build solution and that works when included into a Unreal Plugin following most online Unreal tutorials for how to make a Plugin that uses a Static Library.

Sorry for the convenience but I was able to resolve this issue, now onto trying to test use the code. :) I think I am maybe good now, I'll report back later with my results.

BBlayne avatar Oct 24 '23 00:10 BBlayne

static library is no big deal, i'm working on a DLL build, almost ready!

mrkkrj avatar Oct 24 '23 12:10 mrkkrj

just pushed a CMake project to buil a DLL. Only tested on Windows though!

mrkkrj avatar Oct 24 '23 13:10 mrkkrj

Thanks mate! And so far so good everything on my end with the static library build. Just did a test triangulation from the example project and outputted the results, I'll try a more indepth test over the week trying to display a coloured voronoi diagram or some such. :)

professorbradley avatar Oct 24 '23 14:10 professorbradley