summaryrefslogtreecommitdiff
path: root/src/plugger.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-10-21 17:48:53 +0000
committerMike Buland <eichlan@xagasoft.com>2007-10-21 17:48:53 +0000
commitc55551427b2e8170f91b7e097f8a0f87e3a06305 (patch)
tree4e424f666a4f397817089b2f76637a705f4abaa4 /src/plugger.h
parent6e106a2cc52e3857cbd55d67d54b4589f3425c51 (diff)
downloadlibbu++-c55551427b2e8170f91b7e097f8a0f87e3a06305.tar.gz
libbu++-c55551427b2e8170f91b7e097f8a0f87e3a06305.tar.bz2
libbu++-c55551427b2e8170f91b7e097f8a0f87e3a06305.tar.xz
libbu++-c55551427b2e8170f91b7e097f8a0f87e3a06305.zip
Updated, it uses Bu::FString for it's strings now, much nicer.
Diffstat (limited to 'src/plugger.h')
-rw-r--r--src/plugger.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/plugger.h b/src/plugger.h
index 88628a9..59fa1ac 100644
--- a/src/plugger.h
+++ b/src/plugger.h
@@ -114,7 +114,8 @@ namespace Bu
114 hPlugin.insert( pInfo->sID, pReg ); 114 hPlugin.insert( pInfo->sID, pReg );
115 } 115 }
116 116
117 void registerExternalPlugin( const char *sFName, const char *sPluginName ) 117 void registerExternalPlugin( const Bu::FString &sFName,
118 const Bu::FString &sPluginName )
118 { 119 {
119 PluginReg *pReg; 120 PluginReg *pReg;
120 try { 121 try {
@@ -130,20 +131,23 @@ namespace Bu
130 pReg = new PluginReg; 131 pReg = new PluginReg;
131 132
132 pReg->bBuiltin = false; 133 pReg->bBuiltin = false;
133 pReg->dlHandle = dlopen( sFName, RTLD_NOW ); 134 pReg->dlHandle = dlopen( sFName.getStr(), RTLD_NOW );
134 if( pReg->dlHandle == NULL ) 135 if( pReg->dlHandle == NULL )
135 { 136 {
136 throw PluginException( 1, "Error on %s: %s", sFName, dlerror() ); 137 throw PluginException( 1, "Error on %s: %s", sFName.getStr(),
138 dlerror() );
137 } 139 }
138 pReg->pInfo = (PluginInfo *)dlsym( pReg->dlHandle, sPluginName ); 140 pReg->pInfo = (PluginInfo *)dlsym( pReg->dlHandle,
141 sPluginName.getStr() );
139 if( pReg->pInfo == NULL ) 142 if( pReg->pInfo == NULL )
140 { 143 {
141 throw PluginException( 2, "Error on %s: %s", sFName, dlerror() ); 144 throw PluginException( 2, "Error on %s: %s", sFName.getStr(),
145 dlerror() );
142 } 146 }
143 hPlugin.insert( pReg->pInfo->sID, pReg ); 147 hPlugin.insert( pReg->pInfo->sID, pReg );
144 } 148 }
145 149
146 T *instantiate( const char *lpName ) 150 T *instantiate( const Bu::FString &lpName )
147 { 151 {
148 PluginReg *pReg = (PluginReg *)hPlugin[lpName]; 152 PluginReg *pReg = (PluginReg *)hPlugin[lpName];
149 if( pReg == NULL ) 153 if( pReg == NULL )
@@ -156,7 +160,7 @@ namespace Bu
156 return p; 160 return p;
157 } 161 }
158 162
159 bool hasPlugin( const char *lpName ) 163 bool hasPlugin( const Bu::FString &lpName )
160 { 164 {
161 return hPlugin.has( lpName ); 165 return hPlugin.has( lpName );
162 } 166 }