Re: problems when building Breve plugin

Ian Lindsay <[email protected]> Fri, 28 Jan 2005 18:20:54 -0500
Newsgroups gmane.comp.breve
Message-ID <[email protected]>
With the attached patch, your plugin compiles and links against latest breve
from CVS on MinGW and on Cygwin. Let me know if this works or not.

_______________________________________________
breve mailing list
[email protected]
http://lists.spiderland.org/mailman/listinfo/breve
vicon.diff (text/plain, 3.2 KB)
diff -ru vicon/Makefile vicon-test/Makefile
--- vicon/Makefile	2005-01-27 22:13:34.000000000 -0500
+++ vicon-test/Makefile	2005-01-28 18:06:52.838186000 -0500
@@ -1,30 +1,8 @@
-BREVEPATH=../../bin/breve
+BREVEPATH = ../breve
+CPPFLAGS += -I$(BREVEPATH)/plugins
 
-all:
-
-make -f Makefile `uname`
-
-export
-
-objects: ClientCodes.o ViconRTClient.o breveViconRTClient.o
-
-MINGW32_NT-5.0:
-make objects 'DEFINES=-DWINDOWS'
-
-dlltool -z breveViconRTClient.def breveViconRTClient.o
-
-$(LD) --allow-multiple-definition -shared -o breveViconRTClient_plugin.o
-+breveViconRTClient.o breveViconRTClient.def ViconRTClient.o ClientCodes.o
-+$(BREVEPATH).exe -lgcc -lm -lws2_32 -lstdc++
-
-.c.o:
-
-$(CC) -G $(DEFINES) -c $*.c -I..
-
-.cpp.o:
-
-$(CXX) $(DEFINES) -c $*.cpp -I..
+breveViconRTClient_plugin.o: ClientCodes.o ViconRTClient.o breveViconRTClient.o
+	$(CXX) -shared -o $@ $^ $(BREVEPATH)/lib/plugin.a -lws2_32
 
 clean:
-
--rm *.o
+	rm -f *.o
diff -ru vicon/ViconRTClient.cpp vicon-test/ViconRTClient.cpp
--- vicon/ViconRTClient.cpp	2005-01-27 19:03:32.000000000 -0500
+++ vicon-test/ViconRTClient.cpp	2005-01-28 17:59:49.289152400 -0500
@@ -1,8 +1,6 @@
-
 #include "ViconRTClient.h"
 
 int ViconRTClient::initialize(char* server_ip_addr) {
-
 	
 	#ifdef VC_VERBOSE
 	std::cout << "ViconRTClient: Initializing Winsock" << std::endl;
@@ -83,4 +81,5 @@
 
 	return 0;
 
-}
\ No newline at end of file
+}
+
diff -ru vicon/ViconRTClient.h vicon-test/ViconRTClient.h
--- vicon/ViconRTClient.h	2005-01-27 19:03:33.000000000 -0500
+++ vicon-test/ViconRTClient.h	2005-01-28 17:50:12.339539600 -0500
@@ -5,6 +5,7 @@
 
 #pragma once
 
+#include <winsock2.h>
 
 #include <iostream>
 //#include <cassert>
@@ -15,11 +16,8 @@
 #include <functional>
 #include <limits>
 
-
 #include <math.h>
 
-#include <winsock2.h>
-
 #include "ClientCodes.h"
 
 using namespace std;
@@ -59,4 +57,4 @@
 	long int size;
 
 
-};
\ No newline at end of file
+};
diff -ru vicon/breveViconRTClient.cpp vicon-test/breveViconRTClient.cpp
--- vicon/breveViconRTClient.cpp	2005-01-27 19:03:28.000000000 -0500
+++ vicon-test/breveViconRTClient.cpp	2005-01-28 18:05:30.890350800 -0500
@@ -3,18 +3,14 @@
 // we include this to define ViconRTClient class:
 #include "ViconRTClient.h"
 
+#ifdef _WIN32
+extern "C" __declspec(dllexport) void breveViconRTClientLoadFunctions(void *);
+#else
+extern "C" void breveViconRTClientLoadFunctions(void *);
+#endif
 
-extern "C" void breveViconRTClientLoadFunctions(void *data);
-
-
-	int breveViconRTClient_initialize(stEval args[], stEval *target, void *i);	//	will call:	int initialize(char* server_ip_addr);
-
-#ifdef WINDOWS
-asm(".section .drectve");
-asm(".ascii \"-export:breveViconRTClientLoadFunctions\"");
-#endif /* WINDOWS */
-
-
+//	will call:	int initialize(char* server_ip_addr);
+int breveViconRTClient_initialize(stEval [], stEval *, void *);
 
 //	int initialize(char* server_ip_addr);
 int breveViconRTClient_initialize(stEval args[], stEval *target, void *i) {
@@ -25,8 +21,6 @@
 	return EC_OK;
 }
 
-
-
-extern "C" void breveViconRTClientLoadFunctions(void *data) {
+void breveViconRTClientLoadFunctions(void *data) {
 	stNewSteveCall(data, "breveViconRTClient_initialize", breveViconRTClient_initialize, AT_NULL, AT_POINTER, AT_STRING, 0);
 }