I am trying to get a third party reconstruction library ReconstructMe working by creating a c++ dll and call it within unity(c#).
I have get it working using supplied dll but calling unmanaged function calls are hitting performance on every update for multiple functions e.g:
on every update I am calling below necessary calls:
reme_sensor_grab
reme_sensor_prepare_images
reme_sensor_track_position
reme_sensor_update_volume
reme_surface_generate
For optimization, the idea is if I can make a new DLL including all above functions, calls and this DLL import function will call once per update from unity(c#) or may be call it just once and get data from callbacks.
I have simply used below code to check if I am able to get it working, unfortunately I am getting LNK2019:
RemeDLL.obj : error LNK2019: unresolved external symbol __imp_reme_context_create referenced in function “private: void __cdecl RemeDLL::StartScan(void)” (?StartScan@RemeDLL@@AEAAXXZ)
1>c:\Projects\RemeDLL\x64\Debug\RemeDLL.dll : fatal error LNK1120: 1 unresolved externals
#include <iostream>
#include <reconstructmesdk/reme.h>
using namespace std;
class RemeDLL
{
__declspec(dllexport) void StartScan()
{
// Create a new context
reme_context_t context;
reme_context_create(&context);
//...
}
};
Here are definitions from SDK:
typedef struct _reme_context* reme_context_t;
LIBRECONSTRUCTMESDK_LIBRARY_INTERFACE
reme_error_t reme_context_create(reme_context_t *c);
#define LIBRECONSTRUCTMESDK_LIBRARY_INTERFACE __declspec(dllimport)
Can someone please suggest or give pointers how can I go around this ? Do I need some kind of layers for linking dll to import first and then call dll to export function, please advice. Thanks.