Files
wg_cpso/CppLibrary/dllmain.cpp

40 lines
741 B
C++
Raw Permalink Normal View History

2026-03-25 18:20:24 +08:00
#include <iostream>
#include "stringzilla.hpp"
#include "fast_double_parser.h"
#include "fast.h"
namespace sz = ashvardanian::stringzilla;
namespace fp = fast_double_parser;
extern "C"
{
__declspec(dllexport) void __stdcall Foo(const char* str)
{
std::cout << str << std::endl;
}
__declspec(dllexport) void __stdcall read_node(const char* str, int* id, double* data)
{
auto view = sz::string_view(str);
auto ws = sz::char_set({ ' ', ',', '\t' });
auto list = view.split(ws);
bool first = true;
int idx = 0;
for (auto v : list)
{
if (v.empty()) continue;
if (first)
{
*id = fast_atoi(v.data());
first = false;
}
else
{
fp::parse_number(v.data(), &data[idx]);
idx++;
}
}
}
}