Import and C++
Import and C++
Hi !
Can we import C++ functions with the "Import" feature of Purebasic (I use VC++ express) ?
What syntax should we use for exporting the functions ?
cheers,
Polo
Can we import C++ functions with the "Import" feature of Purebasic (I use VC++ express) ?
What syntax should we use for exporting the functions ?
cheers,
Polo
This is what I'm doing 
When I compile the code with import, the linker hang
I'm pretty sure this is just me doing something wrong with visual C++ express, but I can't figure out what
Here's a quick example to show you what the problem is :
http://dl.free.fr/nopKQCTV1/test.rar
thanks

When I compile the code with import, the linker hang

I'm pretty sure this is just me doing something wrong with visual C++ express, but I can't figure out what

Here's a quick example to show you what the problem is :
http://dl.free.fr/nopKQCTV1/test.rar
thanks

I created a new project with VS2008 and compiled this code to a static library:
The Purebasic Linker doesn't find the function, even when I import it like this
it won't work 
Code: Select all
extern "C" {
int get()
{
return 1;
}
};
Code: Select all
Import "Release/testlib.lib"
get.l() As "get"
EndImport

Windows 7 & PureBasic 4.4
What about :
Code: Select all
ImportC "Release/testlib.lib"
get.l() As "_get"
EndImport
I may look like a mule, but I'm not a complete ass.
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Don't forget that VS2008 doesn't write code that will run on Win9x!VS2008
(I know that this isn't the cause of the problem, but its worth considering if your coding a lib and would like it to run on Win9x machines).
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
It unfortunately doesn't change anything, as the linker just crashsrod wrote:What about :Code: Select all
ImportC "Release/testlib.lib" get.l() As "_get" EndImport

@srod
Sorry, no change, it simply doesn't find the function and outputs this:
I'm aware of this, thanks anyway...
Sorry, no change, it simply doesn't find the function and outputs this:
@DoubleDutchPureBasic - Linker error
POLINK: fatal error: Corrupt library: 'C:\Dokumente und Einstellungen\Milan\Eigene Dateien\testlib\Release\testlib.lib'; unable to find symbol '_get' in member '.\Release\testlib.obj'.
I'm aware of this, thanks anyway...

Windows 7 & PureBasic 4.4