Skip to content

Commit

Permalink
build: Merge standard string functions into xglobals, but for DLL only
Browse files Browse the repository at this point in the history
  • Loading branch information
lhmouse committed Nov 13, 2024
1 parent 0bc6cd5 commit 747a495
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 98 deletions.
20 changes: 0 additions & 20 deletions mcfgthread/memcmp.c

This file was deleted.

20 changes: 0 additions & 20 deletions mcfgthread/memcpy.c

This file was deleted.

26 changes: 0 additions & 26 deletions mcfgthread/memmove.c

This file was deleted.

20 changes: 0 additions & 20 deletions mcfgthread/memset.c

This file was deleted.

34 changes: 34 additions & 0 deletions mcfgthread/xglobals.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,40 @@ __MCF_dll_startup(PVOID instance, ULONG reason, PVOID reserved)
}
}

__declspec(dllexport)
void*
__cdecl
memcpy(void* dst, const void* src, size_t size)
{
return __MCF_mcopy(dst, src, size);
}

__declspec(dllexport)
void*
__cdecl
memmove(void* dst, const void* src, size_t size)
{
return ((uintptr_t) dst - (uintptr_t) src >= size)
? __MCF_mcopy(dst, src, size)
: __MCF_mcopy_backward(dst, src, size);
}

__declspec(dllexport)
int
__cdecl
memcmp(const void* src, const void* cmp, size_t size)
{
return __MCF_mcompare(src, cmp, size);
}

__declspec(dllexport)
void*
__cdecl
memset(void* dst, int val, size_t size)
{
return __MCF_mfill(dst, val, size);
}

#else /* __MCF_BUILDING_DLL */

/* When building the static library, invoke common routines from a TLS
Expand Down
22 changes: 10 additions & 12 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,18 @@ project('mcfgthread',
mcfgthread_include = [
'mcfgthread/fwd.h', 'mcfgthread/atomic.h', 'mcfgthread/clock.h',
'mcfgthread/mutex.h', 'mcfgthread/shared_mutex.h', 'mcfgthread/cond.h',
'mcfgthread/once.h', 'mcfgthread/sem.h', 'mcfgthread/event.h',
'mcfgthread/thread.h', 'mcfgthread/cxa.h', 'mcfgthread/dtor_queue.h',
'mcfgthread/exit.h', 'mcfgthread/tls.h', 'mcfgthread/gthr_aux.h',
'mcfgthread/gthr.h', 'mcfgthread/gthr_libobjc.h', 'mcfgthread/c11.h',
'mcfgthread/libcxx.h', 'mcfgthread/cxx11.hpp' ]
'mcfgthread/once.h', 'mcfgthread/sem.h', 'mcfgthread/event.h', 'mcfgthread/thread.h',
'mcfgthread/cxa.h', 'mcfgthread/dtor_queue.h', 'mcfgthread/exit.h',
'mcfgthread/tls.h', 'mcfgthread/gthr_aux.h', 'mcfgthread/gthr.h',
'mcfgthread/gthr_libobjc.h', 'mcfgthread/c11.h', 'mcfgthread/libcxx.h',
'mcfgthread/cxx11.hpp' ]

mcfgthread_src_min = [
'mcfgthread/memcpy.c', 'mcfgthread/memmove.c', 'mcfgthread/memcmp.c',
'mcfgthread/memset.c', 'mcfgthread/xglobals.c', 'mcfgthread/fwd.c',
'mcfgthread/atomic.c', 'mcfgthread/clock.c', 'mcfgthread/mutex.c',
'mcfgthread/shared_mutex.c', 'mcfgthread/cond.c', 'mcfgthread/once.c',
'mcfgthread/sem.c', 'mcfgthread/event.c', 'mcfgthread/thread.c',
'mcfgthread/cxa.c', 'mcfgthread/dtor_queue.c', 'mcfgthread/exit.c',
'mcfgthread/tls.c', 'mcfgthread/gthr_aux.c' ]
'mcfgthread/xglobals.c', 'mcfgthread/fwd.c', 'mcfgthread/atomic.c',
'mcfgthread/clock.c', 'mcfgthread/mutex.c', 'mcfgthread/shared_mutex.c',
'mcfgthread/cond.c', 'mcfgthread/once.c', 'mcfgthread/sem.c', 'mcfgthread/event.c',
'mcfgthread/thread.c', 'mcfgthread/cxa.c', 'mcfgthread/dtor_queue.c',
'mcfgthread/exit.c', 'mcfgthread/tls.c', 'mcfgthread/gthr_aux.c' ]

mcfgthread_src_ex = [
'mcfgthread/gthr.c', 'mcfgthread/gthr_libobjc.c', 'mcfgthread/c11.c',
Expand Down

0 comments on commit 747a495

Please sign in to comment.