It is currently Thu Dec 05, 2019 11:45 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: DLL, Import = "invalid machine type" for one exe only
PostPosted: Mon Oct 24, 2011 5:00 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Feb 17, 2010 12:00 am
Posts: 1324
Location: (Embarrassed to say country)
I have a project that consists of a few exe's and one dll.
All the exe's use the dll.
All exe's build fine, except one.
When I build it; I'm told that the dll has an invalid machine type.

Image

Just "Import mydll.dll/endimport" will trigger the error. Including one or 20 definitions in the import block doesn't matter -- always gets the "Invalid machine type".

I have rebooted, moved the project (one post said it was a rights issue), created another admin user (I am admin on my machine) -- still happens.

Is there any way to figure out why this one exe doesn't like the dll?
The dll works fine: I have this code (to easily switch back and forth):
Code:
CompilerIf #False
Import "InstTK.dll"
   GetMSSQLServers(nIndex = -1)
EndImport
CompilerElse
   Prototype ptGetMSSQLServers(nIndex=-1)
   hDLL = OpenLibrary(#PB_Any,"Insttk.dll")
   Global GetMSSQLServers.ptGetMSSQLServers = GetFunction(hDLL,"GetMSSQLServers")
CompilerEndIf

So I can use the dll w/o issue. (the exe runs fine & works as expected)
Even if I comment out the call to the dll function, and include no functions, ie:

Code:
Import "InstTK.dll"
EndImport


Will generate the error. Other exe's that include the import build fine.


Top
 Profile  
Reply with quote  
 Post subject: Re: DLL, Import = "invalid machine type" for one exe only
PostPosted: Mon Oct 24, 2011 5:23 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5755
Location: Berlin - Germany
You have to import the "InstTK.lib" or OpenLibrary "InstTK.dll" :wink:

_________________
PureBasic 5.71 | SpiderBasic 2.21 | Windows 10 Pro (x64) | Linux Mint 19.2 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: DLL, Import = "invalid machine type" for one exe only
PostPosted: Mon Oct 24, 2011 7:10 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Feb 17, 2010 12:00 am
Posts: 1324
Location: (Embarrassed to say country)
ts-soft wrote:
You have to import the "InstTK.lib" or OpenLibrary "InstTK.dll" :wink:


HAHAHAHHAHA!! Thanks.
I started having problems about 5am; I should have said "get some rest" -- for hte life of me, I couldn't see that I was using .dll...
Sometimes I wonder how I get out of bed. thanks.


Top
 Profile  
Reply with quote  
 Post subject: Re: DLL, Import = "invalid machine type" for one exe only
PostPosted: Wed Nov 09, 2011 4:26 am 
Offline
Enthusiast
Enthusiast

Joined: Sun Apr 06, 2008 12:54 pm
Posts: 376
Location: Brisbane, Qld, Australia
Thanks - I tripped over the same issue with importing. Was very glad to find the answer on the Forum. :D

_________________
Mike
www.showcuesystems.com


Top
 Profile  
Reply with quote  
 Post subject: Re: DLL, Import = "invalid machine type" for one exe only
PostPosted: Thu Sep 19, 2013 9:37 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Jan 31, 2006 9:43 am
Posts: 492
Location: France
And how to do the same for MacOS ? PB for MacOS generates ".so" files when compiling as "Shared DynLib". But importing this file with "Import" causes a linker error.

_________________
Niffo


Top
 Profile  
Reply with quote  
 Post subject: Re: DLL, Import = "invalid machine type" for one exe only
PostPosted: Fri Sep 20, 2013 12:01 am 
Offline
Addict
Addict

Joined: Fri Apr 25, 2003 11:10 pm
Posts: 1216
I jus tried it on my Mac and it work OK


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye