From 9ae29aa0e9171d0e4ce804c4e0b82d2a7394eac0 Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Sat, 10 Jul 2010 10:53:30 -0800 Subject: [PATCH] Build the demo version of the solver library as a DLL, not a static library. If I understand correctly, that will avoid all the compiler version issues with different required versions of libc. [git-p4: depot-paths = "//depot/solvespace/": change = 2167] --- exposed/Makefile | 9 +++++---- exposed/lib.cpp | 1 + exposed/slvs.h | 26 ++++++++++++++++---------- wishlist.txt | 1 + 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/exposed/Makefile b/exposed/Makefile index 3b09e986..acf2f5a0 100644 --- a/exposed/Makefile +++ b/exposed/Makefile @@ -29,11 +29,12 @@ all: $(OBJDIR)/ctest.exe clean: rm -f obj/* -$(OBJDIR)/slvs.lib: $(SSOBJS) $(LIBOBJS) $(W32OBJS) - @lib /OUT:$(OBJDIR)/slvs.lib $(SSOBJS) $(LIBOBJS) $(W32OBJS) - @echo slvs.lib +$(OBJDIR)/slvs.dll: $(SSOBJS) $(LIBOBJS) $(W32OBJS) + @$(CC) /LD -Fe$(OBJDIR)/slvs.dll $(SSOBJS) $(LIBOBJS) $(W32OBJS) $(LIBS) + @cp $(OBJDIR)/slvs.dll . + @echo slvs.dll -$(OBJDIR)/ctest.exe: example.c $(OBJDIR)/slvs.lib +$(OBJDIR)/ctest.exe: example.c $(OBJDIR)/slvs.dll @$(CC) $(CFLAGS) -Fe$(OBJDIR)/ctest.exe example.c $(OBJDIR)/slvs.lib $(LIBS) @echo ctest.exe diff --git a/exposed/lib.cpp b/exposed/lib.cpp index 817b519b..3450689e 100644 --- a/exposed/lib.cpp +++ b/exposed/lib.cpp @@ -1,4 +1,5 @@ #include "solvespace.h" +#define EXPORT_DLL #include "slvs.h" Sketch SK; diff --git a/exposed/slvs.h b/exposed/slvs.h index 3641d25c..13b7bc85 100644 --- a/exposed/slvs.h +++ b/exposed/slvs.h @@ -15,6 +15,12 @@ #ifndef __SLVS_H #define __SLVS_H +#ifdef EXPORT_DLL +#define DLL __declspec( dllexport ) +#else +#define DLL __declspec( dllimport ) +#endif + #ifdef __cplusplus extern "C" { #endif @@ -181,7 +187,7 @@ typedef struct { int result; } Slvs_System; -void Slvs_Solve(Slvs_System *sys, Slvs_hGroup hg); +DLL void Slvs_Solve(Slvs_System *sys, Slvs_hGroup hg); // Our base coordinate system has basis vectors @@ -190,17 +196,17 @@ void Slvs_Solve(Slvs_System *sys, Slvs_hGroup hg); // basis vectors // U V N // which these functions compute from the quaternion. -void Slvs_QuaternionU(double qw, double qx, double qy, double qz, - double *x, double *y, double *z); -void Slvs_QuaternionV(double qw, double qx, double qy, double qz, - double *x, double *y, double *z); -void Slvs_QuaternionN(double qw, double qx, double qy, double qz, - double *x, double *y, double *z); +DLL void Slvs_QuaternionU(double qw, double qx, double qy, double qz, + double *x, double *y, double *z); +DLL void Slvs_QuaternionV(double qw, double qx, double qy, double qz, + double *x, double *y, double *z); +DLL void Slvs_QuaternionN(double qw, double qx, double qy, double qz, + double *x, double *y, double *z); // Similarly, compute a unit quaternion in terms of two basis vectors. -void Slvs_MakeQuaternion(double ux, double uy, double uz, - double vx, double vy, double vz, - double *qw, double *qx, double *qy, double *qz); +DLL void Slvs_MakeQuaternion(double ux, double uy, double uz, + double vx, double vy, double vz, + double *qw, double *qx, double *qy, double *qz); //------------------------------------- diff --git a/wishlist.txt b/wishlist.txt index bf89f1b6..3c59e8d1 100644 --- a/wishlist.txt +++ b/wishlist.txt @@ -4,6 +4,7 @@ crude DXF, HPGL import a request to import a plane thing make export assemble only contours in same group make export rewrite fill color same as stroke color +choose split point closest to mouse pointer ----- rounding, as a special group