Writing a c++ plugin under windows
"Greg Schmidt" <[email protected]> Thu, 7 Apr 2005 12:28:22 -0400
| Newsgroups | gmane.comp.breve |
|---|---|
| Message-ID | <OFCF79370B.E8450057-ON85256FDC.005A3FCD-85256FDC.005A7CDF@ra.rockwell.com> |
Michael,
Here's a copy of my March posting. I hope it helps. -- Greg
Thanks to Ian's help, I was able to make the c++SampleDemo work with a
VS.NET plugin.
For the benefit of others who may want to try it, here's what I did:
Create a sample Project called VSTest. The project type is "MFC DLL"
Add:
#include "stdafx.h"
to the top of c++Sample.cpp
Also in c++Sample.cpp, change:
int setI(int i) { _i = i; }
int setJ(int j) { _j = j; }
To:
void setI(int i) { _i = i; }
void setJ(int j) { _j = j; }
(the VC++ compiler is strict about return types)
create the following text file:
------------------ begin "breve.def"
NAME breve.exe
EXPORTS
_Z19brObjectGetUserDataP8brObject @1
brDataFree @2
brDataNew @3
brEngineAddInstance @4
brEngineAddObject @5
brEngineAddObjectAlias @6
brEngineRegisterObjectType @7
brEngineRemoveInstance @8
brEngineRemoveInstanceDependency @9
brEngineRemoveInstanceObserver @10
brEvalListInsert @11
brEvalListNew @12
brInstanceAddDependency @13
brInstanceAddObserver @14
brInstanceFree @15
brInstanceGetUserData @16
brInstanceRelease @17
brMethodCall @18
brMethodCallByName @19
brMethodCallByNameWithArgs @20
brMethodFind @21
brMethodFindWithArgRange @22
brMethodFree @23
brNewBreveCall @24
brObjectAddCollisionHandler @25
brObjectFind @26
brObjectFree @27
brObjectSetIgnoreCollisionsWith @28
brPluginFindFile @29
brUnknownObjectFind @30
slFree @31
slGetLogFilePointer @32
slMalloc @33
slMessage @34
slRealloc @35
slStrdup @36
------------------ end "breve.def"
Run:
lib /def:breve.def
and place breve.lib & breve.exp in the project directory
make sure to specify:
NAME breve.exe
at the top of the def file.
Right click on the project in the project tree "properties" and go to
"Linker.Input". As an "additional dependency", add "breve.exe"
In VSTest.def make sure you add the following exports like so:
--------- begin "VSTest.def"
; VSTest.def : Declares the module parameters for the DLL.
LIBRARY "VSTest"
EXPORTS
; Explicit exports can go here
cppSampleLoadFunctions @1
cppSampleMakeTestClass @2
--------- end "VSTest.def"
Build the project and place VSTest.dll in the same directory as
c++SampleDemo.tz
At the top of c++SampleDemo.tz
Replace:
@plugin "c++Sample_plugin.o" (cppSampleLoadFunctions).
With:
@plugin "VSTest.dll" (cppSampleLoadFunctions).
Done.
Best regards,
-- Greg
_______________________________________________
breve mailing list
[email protected]
http://lists.spiderland.org/mailman/listinfo/breve