Objective-C method not found by pb

Mac OSX specific forum
devulder
User
User
Posts: 11
Joined: Fri Dec 19, 2008 5:52 pm

Objective-C method not found by pb

Post by devulder »

Hi All,
I try to create with Xcode a dynamic library (objective-c .mm file) for use with pb.

extern "C" {

void openRequester(void);

}

void
openRequester(void)
{
}

Compilation are ok,

When i use ImportC, loading lib are OK but
pb fails always for find correct method signature for method "openRequester"
Anybody know in github or other a simple example for where is the problem
Thanks,
User avatar
mk-soft
Always Here
Always Here
Posts: 6230
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Objective-C method not found by pb

Post by mk-soft »

I created a library with Xcode for the first time today and it worked.

But I don't know what you have to set to create the "xyz.lib" for ImportC and I could use some help.
So I opened my own lib with OpenLibrary
I watched a simple example on YouTube

New project created for library
- Framework = none
- Dynamic

Project Context
- New from Template -> C++ File include header

libMyLib.hpp

Code: Select all

//
//  libMyLib.hpp
//  MyLib
//
//  Created by Michael on 03.08.25.
//

#ifndef libMyLib_hpp
#define libMyLib_hpp

#include <stdio.h>

extern "C" {
int min(int x, int y);
int max(int x, int y);
}
#endif /* libMyLib_hpp */
libMyLib.cpp

Code: Select all

//
//  libMyLib.cpp
//  MyLib
//
//  Created by Michael on 03.08.25.
//

#include "libMyLib.hpp"

int min(int x, int y) {
    return x < y ? x : y;
}
int max(int x, int y) {
    return x > y ? x : y;
}
PureBasic TextCode

Code: Select all

PrototypeC min(x,y)
PrototypeC max(x,y)

If OpenLibrary(0, "libMyLib.dylib")
  min.min = GetFunction(0, "min")
  max.max = GetFunction(0, "max")
Else
  Debug "no lib"
  End
EndIf

a = 10
b = 20
c = min(a, b)
Debug c
c = max(a, b)
Debug c
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
devulder
User
User
Posts: 11
Joined: Fri Dec 19, 2008 5:52 pm

Re: Objective-C method not found by pb

Post by devulder »

Hi,
Thanks, i look this
Post Reply