Does anyone use minGW to...

Are you developing an External using the LiveCode Externals SDK?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
pkocsis
Posts: 105
Joined: Sat Apr 15, 2006 7:20 am

Does anyone use minGW to...

Post by pkocsis » Wed Nov 18, 2009 10:30 am

...compile externals? If so, do you compile on XP and run on Vista? If so, have you tried your externals on a Vista machine where the default printer is "Send To Onenote 2007" (I'm serious, I don't think it'll work!). This is the problem I'm having......

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Post by mwieder » Wed Nov 18, 2009 10:24 pm

...saw your other post about the printer driver. That's pretty bizarre - I don't know what to say about that one.

I haven't created externals using MinGW, but I have using DevC++, and both of them use the gcc compiler behind the scenes. But I've also avoided Vista whenever possible (99% of the time), so the similarity ends there.

pkocsis
Posts: 105
Joined: Sat Apr 15, 2006 7:20 am

Post by pkocsis » Thu Nov 19, 2009 2:10 am

Thanks for responding! Actually, I *AM* using dev-c++...I knew it used gcc but am under the impression that in the end, it's the minGW compiler...but certainly could be wrong. Probably we're using the very same compiler!

If you ever get the opportunity to try one of your programs that uses a dev-c++ external on vista, if you think of it...go to printers and if there is a "Send To Onenote 2007" printer, make it the default. Then try your program. I bet it will crash as soon as the first external function is called.....It's crazy........

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Post by Janschenkel » Thu Nov 19, 2009 8:07 am

If you can confirm that it happens not only on your machine, but on other machines as well, you really ought to file a bug report at the Quality Control Center so the RunRev team can take a look at it.
Of course, if the externals supplied by RunRev (such as the revXML external), work fine under such circumstances, it's very likely the compiler is doing something wrong.

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

pkocsis
Posts: 105
Joined: Sat Apr 15, 2006 7:20 am

Post by pkocsis » Thu Nov 19, 2009 8:58 pm

Thank you Jan. I have confirmed that this occurs on every 32 bit Vista where there is a "Send To Onenote 2007" printer. I need to test RR's externals though.

For Jan, Mark, etc...can you shed any light on dev-c++ compiler version? Specifically, I'm confused as I have a gcc.exe in the dev-c++ bin folder (dated 2005), and when I try to look for a windows gcc update, I get taken to minGW?

I'm completely confused at the moment on gcc/minGW and how to ensure that I have the latest build of what I need.

Thanks!

Paul

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Post by mwieder » Thu Nov 19, 2009 9:34 pm

Yep - that's 1/29/2005 on my system and getting the version from the command line gives me:

gcc version 3.4.2. (mingw-special)

pkocsis
Posts: 105
Joined: Sat Apr 15, 2006 7:20 am

Re: Does anyone use minGW to...

Post by pkocsis » Sat Dec 12, 2009 5:52 am

I have not solved this problem yet, but I suspect that there may be a compatibility problem with the c runtimes. Specifically, I think the heap corruption may be occurring if the rev engine alloc's memory (rev engine compiled with MSVC) and the dll free's it (my dll being compiled with gcc (mingw)). I don't specifically alloc or free memory, but the rev external SDK wrapper may be attempting a 'free' on memory that was allocated in the engine!?

My question is, does anyone know what compiler was used to compile rev 4.0.0? I assume its MSVC but what version?

I don't know what changes in Vista when 'Send To Onenote 2007' is the default printer, but I suspect that the heap corruption that occurs when calling an external function that DOES NOT blow up (when 'Send To Onenote 2007' is NOT the default printer) is pure luck and this MSVC/MinGW issue will rear its head at other times in the future. Possibly could there be an alignment problem between the MSVC compiled engine and the MinGW compiled external dll?

EDIT: I compiled my test program with Rev 2.6.1 and tried it....worked perfectly....*exact* same external dll that blows up with a 4.0.0 compile. If this is not a Rev issue, then it would seem to be a compiler mismatch between the Rev engine and my (mingw) dll in either passing data or malloc/free issues.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Re: Does anyone use minGW to...

Post by Janschenkel » Sat Dec 12, 2009 4:01 pm

Hmm, interesting development; have you tried using the revXML external library on the machine which crashes Rev 4.0 with the OneNote default printer, and did it work? Also, have you tried your external with Rev 3.5? The externals interface has been updated for Rev 4.0 so there is always a chance some compatibility problem crept in - though I have to say my Windows-VisualC++Express2005 externals seem to work fine with Rev 4.0, as do my Mac-XCode externals.
But then I don't have a Vista with OneNote printer to test things on, heh...

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Does anyone use minGW to...

Post by mwieder » Sun Dec 13, 2009 12:39 am

I think the externals interface changes got pulled before the 4.0 release as not quite ready yet. Without knowing the details of your externals code, it is indeed possible to have memory problems if the wrong function-calling syntax is used - the engine expects to clean up the stack when it's done, and there are external calls where you explicitly need to allocate and/or free memory that's been allocated by the engine. That said, I'm stumped as to why this would work in 2.6.1 and not in 4.0. It would make sense to me if it worked correctly across both versions or didn't work across both versions.

pkocsis
Posts: 105
Joined: Sat Apr 15, 2006 7:20 am

Re: Does anyone use minGW to...

Post by pkocsis » Sun Dec 13, 2009 2:54 am

Jan and Mark, thank you so much for responding.

Jan, the revXML external works fine. I have not tried my external with 3.5...only 2.6.1. Since I'm suspicious of a compiler mismatch issue, I thought I'd go back much further than 3.5. I'll have to try 3.5, but do you know if the compiler used for 3.5 was the same or different as what was used for 4.0? This external and program has worked on every version of windows. The only machines it does not work on is Vista 32-bit when "Send To Onenote 2007" is the default printer. Set the default printer to something else on those machines, and my stuff then works perfectly...

Mark, it would seem that the biggest difference between 2.6.1 and 4.0 is the compiler used to compile Rev. I was suspicious that the c runtime used by the Rev engine may be different than what my dll was compiled to use. This does not seem to be the case. Both seem to be using msvcrt.dll. In researching this problem, I came across a situation out there where an exe was using msvcr71.dll and a dll was using msvcrt.dll. This situation produced a nearly identical crash that I am experiencing. It looks to me though that there is no msvcrt mismatch between the Rev engine and my dll. Also, I am not staticly linking the c runtimes in my dll, so that c runtime dll doesn't seem to be the culprit in this situation.

I will continue to work on this issue and post my findings here. Maybe my experience can save someone else some headaches....if I get it resolved....or WHEN I get it resolved :wink:

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Does anyone use minGW to...

Post by mwieder » Sun Dec 13, 2009 6:39 pm

Not sure if this has any bearing on your situation, but this one bit us earlier this year:

http://tedwvc.wordpress.com/2009/08/10/ ... -kb971090/

pkocsis
Posts: 105
Joined: Sat Apr 15, 2006 7:20 am

Re: Does anyone use minGW to...

Post by pkocsis » Sun Dec 13, 2009 7:00 pm

Thank you! Porting my dll's from dev-c++ to MSVC may be what I have to do to fix my issue. If that's the route I must go, then this link might save me more headaches. Thanks again! (OR, am I missing something in regards to how this link would affect me when using dev-c++?)

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Does anyone use minGW to...

Post by mwieder » Mon Dec 14, 2009 10:35 pm

I just went back to a dll I compiled with DevC++ in 2005 and it still works fine without crashing with rev 4.0, so I don't think switching compilers is the key here (and I'm no fan of Visual Studio, so I'd find it hard to recommend switching).

pkocsis
Posts: 105
Joined: Sat Apr 15, 2006 7:20 am

Re: Does anyone use minGW to...

Post by pkocsis » Tue Dec 15, 2009 5:03 am

Hi Mark,

Keep in mind that the *only* time mine don't work is on Vista when "Send To Onenote 2007" is the default printer. On those very machines, if you set the default printer to something other than "Send To Onenote 2007", then my dll's work fine!

My problem is that many of my new customers have Vista with Office 2007, and Office 2007, from what I've read, tends to set "Send To Onenote 2007" as the default printer on its own. Friends and colleagues have suggested I put out an FAQ or caveat to tell people to set their default printer to something else, but I don't want to do that. I feel like too many folks won't read or do that and the crashing will put my stuff in a bad light.

Thank you for writing Mark! When I find the solution I will certainly post it here!

Post Reply

Return to “Building Externals”