IRC Log Viewer » #firebreath » 2011-12-27

IRC Nick Time (GMT-7) Message
iamamoron 04:12 hi there would it be possible for a firebreath to call a another dll on it c++ program?
FireBreathBot 05:12 JIRA issue http://jira.firebreath.org/browse/FIREBREATH-152 issue created by kario
iamamoron 05:12 FB::variant addtwonumbersAPI::addthis(const FB::variant& a, const FB::variant& b)
{
return (a+b);
}
is this right?
i cannot compile it
dtecta 08:12 Hi there, I'm trying to load a DLL from a firebreath plugin running in IExplorer and get errcode 127 'the specified procedure could not be found'. Usually this turns out to be a forgotten dependency. But in my case dependency walker shows that the installation is OK. I tried both debug and release DLLs. I'm kinda stuck here and was wondering if you have a bright idea.
jshanab_wcw 08:12 There is already a dll with that name loaded at that point? perhaps a previous version and windows is stupid about that sometimes? perhaps close all browsers and then reopen and test
dtecta 09:12 I think I got it. The DLL and its depencies are installed in Program Files/<blah> but the plugin is not. LoadLibrary will load the DLL but it cannot find the dependent DLLs in the same folder. Instead, the plugin will load them from the system path which is of course a different version. Dependency walker *will* look in the smae directory and finds the proper ones. I'm going to try to set the current directory to the install path
"same directory" not "smae" (typing assynchronously).
jshanab_wcw 09:12 dll hell. I only 1/2 understand it. Widows has tried three ways to fix this but doesn't solve the underlying problem. At the time of creation no concept of library versions or symlinks. The newest system (win7) is much better than the XP era much better than the 9x era from what I understand
dtecta 09:12 "much better" as in "store it all in a winsxs directory" which bloats like hell and makes it impossible to trace a DLL back to its user.
I was wrong. When the plugin DLL and dynamically loaded DLLs are in the same directory I still get the same error.
jshanab_wcw 09:12 Still amazes me how they see the obvious solutions but dig their heals in. the "not invented here" syndrom. (like a sql database for debug symbols in compiled code, arughh)
dtecta 09:12 Got it! I needed to SetCurrentDirectory to the install path before loading the DLLs. *sob* I'm using the WIX installer now and it works like a charm.
taxilian 10:12 huh. just missed him, I guess
taxilian 14:12 huh. another day, another job invite. This one from amazon
in their defense, I think I at least meet or exceed every requirement on the posting as well as all of the preferred qualifications. Wonder if any of these jobs will still be around down the road whenever I next am actually looking?
dreid 15:12 OK, so I have a method which returns an FB::VariantList, on Chrome & Firefox this results in a proper javascript array, on IE8 I get something that the Developer Tools describe as "Array of Variant" and which is missing the length property and can't be accessed with the [] operator.
taxilian 15:12 … huh. I've never seen that happen before
dreid 15:12 I'm creating the FB::VariantList by doing FB::make_variant_list(aStdVectorOfStrings)
taxilian 15:12 what is your doctype?
dreid 15:12 <!DOCTYPE html>
taxilian 15:12 hmm. should be fine...
very strange
I have never seen that, but I've used those, I think
so I guess there are a few paths you could take
the easiest would be to just convert it to a regular array in javascript
Array.prototype.slice.call( arguments, 0 ) would probably do it; replace arguments with your pseudo-array, though
dreid 15:12 I'll give that a shot.
taxilian 15:12 another option would be to return JSON (or use JSON to create the JSObject you return). this actually performs better anyway, but does require that you have json support in the page
dreid 15:12 Array.prototype.slice.call(arguments, 0) was no luck, probably because arguments.length is undefined.
taxilian 15:12 could be :-/
that is really really strange
you could also use a for loop to do it
dreid 15:12 Even if I guess and give slice.call a third argument of a suitably high number it simply returns an array with length of 0. Probably because arguments[0] is undefined.
taxilian 15:12 theoretically it should be able to enumerate members even wtihout a length
wait… arguments[0] is undefined?
why?
(note that you shouldn't actually be using that variable name; it's reserved)
dreid 15:12 I don't know why it's undefined.
right, I'm obviously not using that variable name, lets call it files from now on, that's the variable name I'm using.
taxilian 15:12 heh
okay
just making sure
I thought that was the case
hmm
dreid 15:12 files.length is undefined
files[0] is undefined
typeof(files) is "unknown"
taxilian 15:12 that sounds very much like it just simply isn't working at all
which is weird
try compiling/installing FBTestPlugin and running the test.html file in the examples/FBTestPlugin directory
it has unit-test-like-things for htis
dreid 15:12 The "Locals" inspector lists the Type as "Array of Variant" and has the little + and shows all the String elements are there, so somehow the developer tools have figured out that this is a container and can see what is in the container.
taxilian 15:12 dev tools in IE are a bit odd, it is true
however, I know that I've tested the method we use to create arrays in IE
so I'm a bit at a loss as to why you'd be having this issue...
dreid 15:12 Me too. Especially since this worked fine a few weeks ago.
To the best of my knowledge.
taxilian 15:12 ?? have you changed anything?
I know for certain that code hasn't changed in months in FB
dreid 15:12 unfortunately quite a bit and at this point it's non-trivial to revert.
taxilian 15:12 hmm. yeah, I know how that goes
you could pastebin it and I can take a look; maybe I could spot the problem
I wouldn't hold your breath, but I'm willing to try if you'd like
dreid 15:12 return FB::make_variant_list(openFile());
where openFile returns std::vector<std::string> :)
taxilian 15:12 hmm
and the return type of the function it's in?
dreid 15:12 FB::VariantList
taxilian 15:12 hmm
and what version of FireBreath?
dreid 15:12 The test plugin is building now by the way. I'll let you know when I've run it.
I'm currently using the 1.6.0 tag.
taxilian 15:12 hmm. don't use the tag, use the branch
we're somewhere past 1.6.0 with a few minor bugfixes, but not quite to 1.6.1 yet =]
the 1.6 branch is stable and gets occasional specific fixes
that shouldn't matter in your current case, though
since nothing related to that has changed
dreid 16:12 OK, rebuilding on the branch.
dreid 16:12 As expected no change from rebuilding on the 1.6 branch. Trying to build the FBTestPlugin now.
dreid 16:12 Oh hrmm...
So, if I change it to return an FB::VariantMap with a single key "files" and the value being the FB::make_variant_list(openFiles()) I actually get back an Array of Variant with 2 elements, 0 being "files" and 1 being the list of files. Still can't actually iterate or access the elements.
taxilian 16:12 ...
that's bizarre
sorry if I'm starting to sound repetitive =]
dreid 16:12 No, it's OK. It's reassuring to know that I am not necessarily stupid or insane.
The FBTestPlugin build appears to be almost done.
taxilian 16:12 what version of vs?
dreid 16:12 2010 professional
taxilian 16:12 hmm. okay; that's what I use
dreid 16:12 Well this is exciting.
FBTestPlugin appears to work just fine.
taxilian 16:12 now you just need to figure out what the difference is
I wouldn't rule out the possibility of other weird items on the page or page settings
compatibility mode, standards mode, etc
or installation abnormalities
dreid 17:12 The page is in IE8 Standards mode, a separate page which just runs the javascript for loading and invoking the plugin has the same problem.
I guess I'll try the JSON.
taxilian 17:12 did you try putting FBTestPlugin in IE8 standards mode?
IE standards mode does weird things to plugins sometimes...
if you want to use json, you can use jsoncpp which is already included with FireBreath
and there is a tool to convert a FB::variant to a Json object
and bakc
dreid 17:12 FBTestPlugin works in IE8 Standards mode
taxilian 17:12 hmm
weird
uninstall/reinstall yours? restart IE completely? reboot computer?
install Mac OS?
oh, wait… maybe not the last one
dreid 17:12 I'm running Windows 7 in a Parallels VM. :)
I've reinstalled my plugin several times, I've restarted IE and the VM several times.
taxilian 17:12 hmm
:-/
dreid 17:12 Yup.
I should have taken a few more days of vacation.
taxilian 17:12 lol
iamamoron 17:12 hi there would it be possible to call another dll inside a .sln file ?
taxilian 17:12 no, because .sln files don't execute and therefore can't call executable code
if you're wondering if a plugin can call a DLL external to the project, then the answer is yes, it can
did you figure out your compilation problem earlier?
iamamoron 18:12 yes i have
i really want to call a dll external to the project
taxilian 18:12 oh, good
I figured
the main trick you may have is that you don't always know what the path and current directory are
they can even change unexpectedly
iamamoron 18:12 earlier i created a test function only
for tutorial
now I am on my intentions to call a dll
taxilian 18:12 but if you delayload the dll (/DELAYLOAD linker option) you can use SetDllDirectory to set the dll directory search path to the same as where your plugin is
or wherever else it should look
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686203%28v=vs.85%29.aspx
iamamoron 18:12 my intention is to use the dll
taxilian 18:12 … right… got that part. I just told you how to do it
iamamoron 18:12 of my biometrics and try to put it in web
taxilian 18:12 well, how it differs from doing it in a normal C++ project, anyway.
iamamoron 18:12 would it be possible?
normal c++ is very different
thats why i am in ground zero now
taxilian 18:12 first, understand that this is normal C++, but you are living inside a different process. that's the only thing that changes
the way you'd use a DLL from any other C++ project? same as you'll use it in a FireBreath project, except for what I told you above
iamamoron 18:12 are there any tutorials on how to call a dll?
taxilian 18:12 .lmgt tutorial on calling a dll with C++
FireBreathBot 18:12 Let me google that for you: http://goo.gl/8iWxx
iamamoron 18:12 i mean a detailed one
for a newbie like me
iamamoron 18:12 LoadLibrary is not supported in firebreath
taxilian 18:12 LoadLibrary has nothing to do with firebreath or other frameworsk
it's a windows API call
iamamoron 18:12 sorry
taxilian 18:12 FireBreath doesn't change the fact that this is C++
you can still call windows APIs
you can still use the STL
or boost
or whatever else you'd like to use
LoadLibrary is a win32 API call, and as such you can use it as long as you are in win32
anyway, I gotta run for now. good luck
iamamoron 18:12 thanks taxilian
iamamoron 18:12 9>D:\chromeplugin\projects\nkymbio\nkymbioAPI.cpp(103): error C2065: 'HINSTANCE' : undeclared identifier
9>D:\chromeplugin\projects\nkymbio\nkymbioAPI.cpp(103): error C2146: syntax error : missing ';' before identifier 'hGetProcIDDLL'
9>D:\chromeplugin\projects\nkymbio\nkymbioAPI.cpp(103): error C2065: 'hGetProcIDDLL' : undeclared identifier
9>D:\chromeplugin\projects\nkymbio\nkymbioAPI.cpp(103): error C3861: 'LoadLibrary': identifier not found
taxilian 18:12 iamamoron: you are missing required #include directives
iamamoron 18:12 for the dll?
taxilian 18:12 C++ tip: if you ever get a "undeclared identifier" or "identifier not found" error when you know you have the right identifier, it means you're missing a header file
iamamoron 18:12 hmm
what should it be
sorry for my dumbness
taxilian 18:12 I'll do this for you once; next time I expect you to google it yourself
iamamoron 18:12 std::string nkymbioAPI::initbio()
{
string str;
//HINSTANCE hGetProcIDDLL = LoadLibrary("DPFPDevX.dll");
}
even this
taxilian 18:12 .lmgt LoadLibrary
iamamoron 18:12 std::string nkymbioAPI::initbio()
{
string str;
//HINSTANCE hGetProcIDDLL = LoadLibrary("DPFPDevX.dll");
}
FireBreathBot 18:12 Let me google that for you: http://goo.gl/n0A16
taxilian 18:12 first result
scroll towards the bottom, look for a table with a left column that says "Header"
it reads: Winbase.h (include Windows.h)
in other words, you need to #include <Windows.h> in order to use that function
all windows API functions are documented like that
also while you're there note what library is required; in some cases you may need to add a link to that library
but not in this case because kernel32 is already linked
now that you know, I will get cranky if you ask me to do your homework for you next time ;-)
but you have to learn somewhere
so I don't mind pointing you in the right direction
iamamoron 18:12 do i need to declares windows.h in .h and .cpp file?
taxilian 18:12 whenever possible, avoid including things in a header file
always do it in the .cpp file unless you have to have it for the header to work
dpemmons 19:12 does anyone know of a good shell / example project that sets up an OpenGL context for a plugin for all 3 platforms?